ACS-Redis-FlushExpireKeys

模板名称

ACS-Redis-FlushExpireKeys 清理Redis过期key

立即执行

模板描述

清理Redis过期key

模板类型

自动化

所有者

Alibaba Cloud

输入参数

参数名称

描述

类型

是否必填

默认值

约束

Targets

目标实例

Json

RegionId

地域ID

String

{{ ACS::RegionId }}

RateControl

任务执行的并发比率

Json

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

OOSAssumeRole

OOS扮演的RAM角色

String

""

输出参数

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

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "kvstore:DescribeInstances",
                "kvstore:FlushExpireKeys"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

详情

ACS-Redis-FlushExpireKeys详情

模板内容

FormatVersion: OOS-2019-06-01
Description:
  en: FlushExpireKeys of redis instances
  zh-cn: 清理Redis过期key
  name-en: ACS-Redis-FlushExpireKeys
  name-zh-cn: 清理Redis过期key
  categories:
    - security
Parameters:
  RegionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: 地域ID
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  Targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: 目标实例
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: ALIYUN::Redis::Instance
      RegionId: regionId
  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: FlushExpireKeys
    Action: ACS::ExecuteApi
    Description:
      en: Flush expire keys of redis instances
      zh-cn: 清理Redis过期key
    Properties:
      Service: r-kvstore
      API: FlushExpireKeys
      Parameters:
        InstanceId: '{{ ACS::TaskLoopItem }}'
        EffectiveTime: Immediately
    Loop:
      RateControl: '{{ RateControl }}'
      Items: '{{ GetInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - config
        Label:
          default:
            zh-cn: 设置参数
            en: Configure Parameters
      - Parameters:
          - regionId
          - instanceIds
        Label:
          default:
            zh-cn: 选择实例
            en: Select Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 高级选项
            en: Control Options