全部产品
Search
文档中心

系统运维管理:ACS-Redis-BulkyCreateBackupAndUploadToOSS

更新时间:Nov 22, 2024

模板名称

ACS-Redis-BulkyCreateBackupAndUploadToOSS 批量创建Redis备份并上传到OSS

立即执行

模板描述

批量创建Redis备份并上传到OSS。备份redis和使用fc将备份上传到oss都可能会产生费用,计费详情参考自动或手动备份计费概述

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

targets

目标实例

Json

OSSRegionId

OSS Bucket所在地域ID

String

OSSBucketName

OSS Bucket名称

String

regionId

地域ID

String

{{ACS::RegionId}}

rateControl

任务执行的并发比率

Json

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

OOS扮演的RAM角色

String

""

输出参数

参数名称

描述

类型

OSSObjectURLs

List

执行此模板需要的权限策略

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "kvstore:CreateBackup",
                "kvstore:DescribeBackupTasks",
                "kvstore:DescribeBackups",
                "kvstore:DescribeInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ros:CreateStack",
                "ros:DeleteStack",
                "ros:GetStack"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

详情

ACS-Redis-BulkyCreateBackupAndUploadToOSS详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  en: Create Redis backups in batches and upload them to OSS. Backing up redis and using fc to upload the backup to OSS may incur charges. For billing details, please refer to <a href='https://help .aliyun.com/zh/redis/user-guide/automatic-or-manual-backup#e606eb29c7mew'>Redis Backup Fee Instructions</a> and <a href='https://help.aliyun.com/zh/ fc/product-overview/billing-overview'>Function calculation billing instructions</a>
  zh-cn: 批量创建Redis备份并上传到OSS。备份redis和使用fc将备份上传到oss都可能会产生费用,计费详情参考<a href='https://help.aliyun.com/zh/redis/user-guide/automatic-or-manual-backup#e606eb29c7mew'>Redis备份费用说明</a>和<a href='https://help.aliyun.com/zh/fc/product-overview/billing-overview'>函数计算计费说明</a>
  name-en: ACS-Redis-BulkyCreateBackupAndUploadToOSS
  name-zh-cn: 批量创建Redis备份并上传到OSS
Parameters:
  regionId:
    Label:
      en: RegionId
      zh-cn: 地域ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ACS::RegionId}}'
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: 目标实例
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: ALIYUN::Redis::Instance
      RegionId: regionId
  OSSRegionId:
    Label:
      en: OSSRegionId
      zh-cn: OSS Bucket所在地域ID
    Type: String
    AssociationProperty: RegionId
  OSSBucketName:
    Label:
      en: OSSBucketName
      zh-cn: OSS Bucket名称
    Type: String
    AssociationProperty: ALIYUN::OSS::Bucket::BucketName
    AssociationPropertyMetadata:
      RegionId: ${OSSRegionId}
  rateControl:
    Label:
      en: RateControl
      zh-cn: 任务执行的并发比率
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: GetInstance
    Description:
      en: Get the redis instances
      zh-cn: 获取Redis实例
    Action: ACS::SelectTargets
    Properties:
      ResourceType: ALIYUN::Redis::Instance
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      InstanceIds:
        Type: List
        ValueSelector: Instances.Instance[].InstanceId
  - Name: CreateBackupAndUploadToOSS
    Action: ACS::Redis::CreateBackupAndUploadToOSS
    Description:
      en: Create backup and upload to OSS
      zh-cn: 创建Redis备份并上传到OSS
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      OSSRegionId: '{{ OSSRegionId }}'
      OSSBucketName: '{{ OSSBucketName }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ GetInstance.InstanceIds }}'
      Outputs:
        OSSObjectURLs:
          AggregateType: Fn::ListJoin
          AggregateField: OSSObjectURL
    Outputs:
      OSSObjectURL:
        Type: String
        ValueSelector: '.OSSObjectURL + "{{ACS::ExecutionId}}/"  | split(".t0") | .[0]'
Outputs:
  OSSObjectURLs:
    Type: List
    Value: '{{ CreateBackupAndUploadToOSS.OSSObjectURLs }}'