ALIYUN::RAM::Group类型用于创建RAM用户组。
语法
{
"Type": "ALIYUN::RAM::Group",
"Properties": {
"GroupName": String,
"Comments": String,
"Policies": List,
"PolicyAttachments": Map,
"DeletionForce": Boolean,
"IgnoreExisting": Boolean
}
}
属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
GroupName |
String |
是 |
否 |
用户组名称。 |
长度为1~64个字符,可包含英文字母、数字和短划线(-)。 |
|
Comments |
String |
否 |
是 |
备注信息。 |
长度为1~128个字符。 |
|
DeletionForce |
Boolean |
否 |
是 |
是否强制解绑RAM用户组的策略。 |
取值:
|
|
IgnoreExisting |
Boolean |
否 |
否 |
是否忽略现有组。 |
取值:
|
|
Policies |
List |
否 |
是 |
权限策略。 |
更多信息,请参见Policies属性。 |
|
PolicyAttachments |
Map |
否 |
是 |
要添加的系统和自定义策略名称。 |
更多信息,请参见PolicyAttachments属性。 |
Policies语法
"Policies": [
{
"Description": String,
"PolicyName": String,
"PolicyDocument": Map,
"IgnoreExisting": Boolean
}
]
Policies属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
PolicyDocument |
Map |
是 |
是 |
权限策略内容。 |
长度不超过2048个字符。 关于权限策略元素和示例,请参见权限策略基本元素和权限策略示例库概览。 更多信息,请参见PolicyDocument属性。 |
|
PolicyName |
String |
是 |
否 |
权限策略名称。 |
长度为1~128个字符,可包含英文字母、数字和短划线(-)。 |
|
Description |
String |
否 |
否 |
描述。 |
长度为1~1024个字符。 |
|
IgnoreExisting |
Boolean |
否 |
否 |
是否忽略现有策略。 |
取值:
|
PolicyDocument语法
"PolicyDocument": {
"Version": String,
"Statement": List
}
PolicyDocument属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Statement |
List |
是 |
否 |
权限策略规则。 |
更多信息,请参见Statement属性。 |
|
Version |
String |
是 |
否 |
权限策略版本。 |
无 |
Statement语法
"Statement": [
{
"Condition": Map,
"Action": List,
"Resource": List,
"Effect": String,
"NotAction": List
}
]
Statement属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Action |
List |
否 |
否 |
权限策略针对的具体操作。 |
无 |
|
Condition |
Map |
否 |
否 |
授权生效的限制条件。 |
无 |
|
Effect |
String |
否 |
否 |
授权效力。 |
取值:
|
|
NotAction |
List |
否 |
否 |
允许或拒绝时例外的指定操作 |
无 |
|
Resource |
List |
否 |
否 |
权限策略针对的具体资源。 |
无 |
PolicyAttachments语法
"PolicyAttachments": {
"System": List,
"Custom": List
}
PolicyAttachments属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Custom |
List |
否 |
是 |
自定义策略名称列表。 |
策略数量小于等于5。 |
|
System |
List |
否 |
是 |
系统策略名称列表。 |
策略数量小于等于20。 |
返回值
Fn::GetAtt
GroupName:RAM用户组名称。
示例
场景 1 :创建RAM用户组并附加系统权限策略,实现团队只读访问控制。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建RAM用户组并附加系统权限策略,实现团队只读访问控制。
en: Create a RAM group with system policies for team read-only access control.
Parameters:
GroupName:
Type: String
Label:
zh-cn: 用户组名称
en: Group Name
Description:
zh-cn: >-
RAM用户组名称,1~64个字符,
可包含英文字母、数字和短横线。
en: >-
RAM group name, 1-64 characters,
may contain letters, digits and hyphens.
Default: readonly-team
Comments:
Type: String
Label:
zh-cn: 用户组备注
en: Group Comments
Description:
zh-cn: 用户组的备注说明,1~128个字符。
en: Comments for the group, 1-128 characters.
Default: 只读访问权限组,用于运维巡检和审计
MaxLength: 128
Resources:
Group:
Type: ALIYUN::RAM::Group
Properties:
GroupName:
Ref: GroupName
Comments:
Ref: Comments
PolicyAttachments:
System:
- AliyunECSReadOnlyAccess
- AliyunOSSReadOnlyAccess
- AliyunRDSReadOnlyAccess
- AliyunVPCReadOnlyAccess
Outputs:
GroupName:
Label:
zh-cn: 用户组名称
en: Group Name
Description:
zh-cn: 创建成功的RAM用户组名称。
en: The name of the created RAM group.
Value:
Fn::GetAtt:
- Group
- GroupName{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建RAM用户组并附加系统权限策略,实现团队只读访问控制。",
"en": "Create a RAM group with system policies for team read-only access control."
},
"Parameters": {
"GroupName": {
"Type": "String",
"Label": {
"zh-cn": "用户组名称",
"en": "Group Name"
},
"Description": {
"zh-cn": "RAM用户组名称,1~64个字符,可包含英文字母、数字和短横线。",
"en": "RAM group name, 1-64 characters, may contain letters, digits and hyphens."
},
"Default": "readonly-team"
},
"Comments": {
"Type": "String",
"Label": {
"zh-cn": "用户组备注",
"en": "Group Comments"
},
"Description": {
"zh-cn": "用户组的备注说明,1~128个字符。",
"en": "Comments for the group, 1-128 characters."
},
"Default": "只读访问权限组,用于运维巡检和审计",
"MaxLength": 128
}
},
"Resources": {
"Group": {
"Type": "ALIYUN::RAM::Group",
"Properties": {
"GroupName": {
"Ref": "GroupName"
},
"Comments": {
"Ref": "Comments"
},
"PolicyAttachments": {
"System": [
"AliyunECSReadOnlyAccess",
"AliyunOSSReadOnlyAccess",
"AliyunRDSReadOnlyAccess",
"AliyunVPCReadOnlyAccess"
]
}
}
}
},
"Outputs": {
"GroupName": {
"Label": {
"zh-cn": "用户组名称",
"en": "Group Name"
},
"Description": {
"zh-cn": "创建成功的RAM用户组名称。",
"en": "The name of the created RAM group."
},
"Value": {
"Fn::GetAtt": [
"Group",
"GroupName"
]
}
}
}
}场景 2 :创建RAM用户组并配置内联自定义策略,限定特定资源的操作权限。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建RAM用户组并配置内联自定义策略,限定特定资源的操作权限。
en: Create a RAM group with inline custom policies for fine-grained access control.
Parameters:
GroupName:
Type: String
Label:
zh-cn: 用户组名称
en: Group Name
Description:
zh-cn: RAM用户组名称。
en: The RAM group name.
Default: dev-team
Comments:
Type: String
Label:
zh-cn: 用户组备注
en: Group Comments
Description:
zh-cn: 用户组的备注说明。
en: Comments for the group.
Default: 开发团队权限组,拥有指定资源的读写权限
MaxLength: 128
OssBucketName:
Type: String
Label:
zh-cn: OSS存储桶名称
en: OSS Bucket Name
Description:
zh-cn: 允许开发团队访问的OSS存储桶名称。
en: The OSS bucket name that the dev team is allowed to access.
Resources:
Group:
Type: ALIYUN::RAM::Group
Properties:
GroupName:
Ref: GroupName
Comments:
Ref: Comments
Policies:
- PolicyName:
Fn::Sub: ${GroupName}-oss-policy
Description: 允许对指定OSS存储桶进行读写操作
PolicyDocument:
Version: '1'
Statement:
- Effect: Allow
Action:
- oss:GetObject
- oss:PutObject
- oss:DeleteObject
- oss:ListObjects
- oss:GetBucket
Resource:
- Fn::Sub: acs:oss:*:*:${OssBucketName}
- Fn::Sub: acs:oss:*:*:${OssBucketName}/*
- PolicyName:
Fn::Sub: ${GroupName}-ecs-policy
Description: 允许查看和管理ECS实例
PolicyDocument:
Version: '1'
Statement:
- Effect: Allow
Action:
- ecs:DescribeInstances
- ecs:DescribeInstanceStatus
- ecs:StartInstance
- ecs:StopInstance
- ecs:RebootInstance
Resource:
- '*'
- Effect: Deny
Action:
- ecs:DeleteInstance
Resource:
- '*'
DeletionForce: true
Outputs:
GroupName:
Label:
zh-cn: 用户组名称
en: Group Name
Description:
zh-cn: 创建成功的RAM用户组名称。
en: The name of the created RAM group.
Value:
Fn::GetAtt:
- Group
- GroupName{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建RAM用户组并配置内联自定义策略,限定特定资源的操作权限。",
"en": "Create a RAM group with inline custom policies for fine-grained access control."
},
"Parameters": {
"GroupName": {
"Type": "String",
"Label": {
"zh-cn": "用户组名称",
"en": "Group Name"
},
"Description": {
"zh-cn": "RAM用户组名称。",
"en": "The RAM group name."
},
"Default": "dev-team"
},
"Comments": {
"Type": "String",
"Label": {
"zh-cn": "用户组备注",
"en": "Group Comments"
},
"Description": {
"zh-cn": "用户组的备注说明。",
"en": "Comments for the group."
},
"Default": "开发团队权限组,拥有指定资源的读写权限",
"MaxLength": 128
},
"OssBucketName": {
"Type": "String",
"Label": {
"zh-cn": "OSS存储桶名称",
"en": "OSS Bucket Name"
},
"Description": {
"zh-cn": "允许开发团队访问的OSS存储桶名称。",
"en": "The OSS bucket name that the dev team is allowed to access."
}
}
},
"Resources": {
"Group": {
"Type": "ALIYUN::RAM::Group",
"Properties": {
"GroupName": {
"Ref": "GroupName"
},
"Comments": {
"Ref": "Comments"
},
"Policies": [
{
"PolicyName": {
"Fn::Sub": "${GroupName}-oss-policy"
},
"Description": "允许对指定OSS存储桶进行读写操作",
"PolicyDocument": {
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"oss:GetObject",
"oss:PutObject",
"oss:DeleteObject",
"oss:ListObjects",
"oss:GetBucket"
],
"Resource": [
{
"Fn::Sub": "acs:oss:*:*:${OssBucketName}"
},
{
"Fn::Sub": "acs:oss:*:*:${OssBucketName}/*"
}
]
}
]
}
},
{
"PolicyName": {
"Fn::Sub": "${GroupName}-ecs-policy"
},
"Description": "允许查看和管理ECS实例",
"PolicyDocument": {
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInstanceStatus",
"ecs:StartInstance",
"ecs:StopInstance",
"ecs:RebootInstance"
],
"Resource": [
"*"
]
},
{
"Effect": "Deny",
"Action": [
"ecs:DeleteInstance"
],
"Resource": [
"*"
]
}
]
}
}
],
"DeletionForce": true
}
}
},
"Outputs": {
"GroupName": {
"Label": {
"zh-cn": "用户组名称",
"en": "Group Name"
},
"Description": {
"zh-cn": "创建成功的RAM用户组名称。",
"en": "The name of the created RAM group."
},
"Value": {
"Fn::GetAtt": [
"Group",
"GroupName"
]
}
}
}
}场景 3 :创建RAM用户组并同时附加系统策略和自定义策略,实现混合权限管理。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建RAM用户组并同时附加系统策略和自定义策略,实现混合权限管理。
en: Create a RAM group with both system and custom policy attachments for hybrid access control.
Parameters:
GroupName:
Type: String
Label:
zh-cn: 用户组名称
en: Group Name
Description:
zh-cn: RAM用户组名称,1~64个字符。
en: RAM group name, 1-64 characters.
Default: ops-team
Comments:
Type: String
Label:
zh-cn: 用户组备注
en: Group Comments
Description:
zh-cn: 用户组的备注说明。
en: Comments for the group.
Default: 运维团队权限组,拥有系统和自定义混合权限
MaxLength: 128
SystemPolicies:
Type: Json
Label:
zh-cn: 系统策略列表
en: System Policies
Description:
zh-cn: >-
要附加的系统预置策略名称列表,最多20条。
常用策略:AliyunECSFullAccess、AliyunOSSFullAccess、
AliyunRDSFullAccess、AliyunVPCFullAccess、AliyunSLBFullAccess。
en: >-
List of system policy names to attach, up to 20.
Default:
- AliyunECSFullAccess
- AliyunVPCFullAccess
- AliyunSLBFullAccess
AssociationProperty: List[Parameter]
AssociationPropertyMetadata:
Parameter:
Type: String
Required: true
Label:
zh-cn: 系统策略名称
en: System Policy Name
CustomPolicies:
Type: Json
Label:
zh-cn: 自定义策略列表
en: Custom Policies
Description:
zh-cn: >-
要附加的自定义策略名称列表,最多5条。
需要提前在RAM控制台创建好自定义策略。
en: >-
List of custom policy names to attach, up to 5.
Custom policies must be created in RAM console first.
Default: []
AssociationProperty: List[Parameter]
AssociationPropertyMetadata:
Parameter:
Type: String
Required: false
Label:
zh-cn: 自定义策略名称
en: Custom Policy Name
Resources:
Group:
Type: ALIYUN::RAM::Group
Properties:
GroupName:
Ref: GroupName
Comments:
Ref: Comments
PolicyAttachments:
System:
Ref: SystemPolicies
Custom:
Ref: CustomPolicies
DeletionForce: true
IgnoreExisting: true
Outputs:
GroupName:
Label:
zh-cn: 用户组名称
en: Group Name
Description:
zh-cn: 创建成功的RAM用户组名称。
en: The name of the created RAM group.
Value:
Fn::GetAtt:
- Group
- GroupName{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建RAM用户组并同时附加系统策略和自定义策略,实现混合权限管理。",
"en": "Create a RAM group with both system and custom policy attachments for hybrid access control."
},
"Parameters": {
"GroupName": {
"Type": "String",
"Label": {
"zh-cn": "用户组名称",
"en": "Group Name"
},
"Description": {
"zh-cn": "RAM用户组名称,1~64个字符。",
"en": "RAM group name, 1-64 characters."
},
"Default": "ops-team"
},
"Comments": {
"Type": "String",
"Label": {
"zh-cn": "用户组备注",
"en": "Group Comments"
},
"Description": {
"zh-cn": "用户组的备注说明。",
"en": "Comments for the group."
},
"Default": "运维团队权限组,拥有系统和自定义混合权限",
"MaxLength": 128
},
"SystemPolicies": {
"Type": "Json",
"Label": {
"zh-cn": "系统策略列表",
"en": "System Policies"
},
"Description": {
"zh-cn": "要附加的系统预置策略名称列表,最多20条。常用策略:AliyunECSFullAccess、AliyunOSSFullAccess、AliyunRDSFullAccess、AliyunVPCFullAccess、AliyunSLBFullAccess。",
"en": "List of system policy names to attach, up to 20."
},
"Default": [
"AliyunECSFullAccess",
"AliyunVPCFullAccess",
"AliyunSLBFullAccess"
],
"AssociationProperty": "List[Parameter]",
"AssociationPropertyMetadata": {
"Parameter": {
"Type": "String",
"Required": true,
"Label": {
"zh-cn": "系统策略名称",
"en": "System Policy Name"
}
}
}
},
"CustomPolicies": {
"Type": "Json",
"Label": {
"zh-cn": "自定义策略列表",
"en": "Custom Policies"
},
"Description": {
"zh-cn": "要附加的自定义策略名称列表,最多5条。需要提前在RAM控制台创建好自定义策略。",
"en": "List of custom policy names to attach, up to 5. Custom policies must be created in RAM console first."
},
"Default": [],
"AssociationProperty": "List[Parameter]",
"AssociationPropertyMetadata": {
"Parameter": {
"Type": "String",
"Required": false,
"Label": {
"zh-cn": "自定义策略名称",
"en": "Custom Policy Name"
}
}
}
}
},
"Resources": {
"Group": {
"Type": "ALIYUN::RAM::Group",
"Properties": {
"GroupName": {
"Ref": "GroupName"
},
"Comments": {
"Ref": "Comments"
},
"PolicyAttachments": {
"System": {
"Ref": "SystemPolicies"
},
"Custom": {
"Ref": "CustomPolicies"
}
},
"DeletionForce": true,
"IgnoreExisting": true
}
}
},
"Outputs": {
"GroupName": {
"Label": {
"zh-cn": "用户组名称",
"en": "Group Name"
},
"Description": {
"zh-cn": "创建成功的RAM用户组名称。",
"en": "The name of the created RAM group."
},
"Value": {
"Fn::GetAtt": [
"Group",
"GroupName"
]
}
}
}
}