Template name
ACS-ECS-BulkDetachInstanceRamRole Batch detach RAM roles from instances
Template description
Detaches a Resource Access Management (RAM) role from multiple Elastic Compute Service (ECS) instances at a time.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
|
Parameter |
Description |
Type |
Required |
Default value |
Limit |
|
targets |
The target instances. |
Json |
Yes |
||
|
RamRoleName |
The name of the RAM role. |
String |
Yes |
||
|
regionId |
The region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
rateControl |
The concurrency settings for task execution. |
Json |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
The RAM role assumed by CloudOps Orchestration Service (OOS). |
String |
No |
"" |
Output parameters
|
Parameter |
Description |
Type |
|
instanceIds |
List |
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DetachInstanceRamRole"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
For more information, see ACS-ECS-BulkyDetachInstanceRamRole.yml on GitHub.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Bulk-detaches a RAM role from instances.
name-en: ACS-ECS-BulkyDetachInstanceRamRole
categories:
- instance_manage
Parameters:
regionId:
Type: String
Label:
en: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Type: Json
Label:
en: Target Instance
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
RegionId: regionId
RamRoleName:
Label:
en: RAM Role Name
Type: String
rateControl:
Label:
en: Rate Control
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOS Assume Role
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Retrieves the specified ECS instances.
Action: ACS::SelectTargets
Properties:
RegionId: '{{ regionId }}'
ResourceType: ALIYUN::ECS::Instance
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: detachInstanceRamRole
Action: ACS::ExecuteApi
Description:
en: Detaches the specified RAM role from the instance.
Properties:
Service: ECS
API: DetachInstanceRamRole
Parameters:
RegionId: '{{ regionId }}'
RamRoleName: '{{ RamRoleName }}'
InstanceIds:
- '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
instanceIds:
Type: List
Value: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- RamRoleName
Label:
default:
en: Configure Parameters
- Parameters:
- regionId
- targets
Label:
default:
en: Select Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
en: Advanced Options