O recurso ALIYUN::RAM::Group cria um grupo de usuários do Resource Access Management (RAM).
Sintaxe
{
"Type": "ALIYUN::RAM::Group",
"Properties": {
"GroupName": String,
"Comments": String,
"Policies": List,
"PolicyAttachments": Map,
"DeletionForce": Boolean,
"IgnoreExisting": Boolean
}
}
Propriedades
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrições |
|
GroupName |
String |
Sim |
Não |
Nome do grupo de usuários. |
O nome deve ter de 1 a 64 caracteres e pode conter letras, dígitos e hifens (-). |
|
Comments |
String |
Não |
Sim |
Observações sobre o grupo. |
O valor deve ter de 1 a 128 caracteres. |
|
DeletionForce |
Boolean |
Não |
Sim |
Define se as políticas devem ser desanexadas à força do grupo de usuários do RAM. |
Valores válidos:
|
|
IgnoreExisting |
Boolean |
Não |
Não |
Indica se grupos existentes devem ser ignorados. |
Valores válidos:
|
|
Policies |
List |
Não |
Sim |
Políticas de acesso associadas. |
Para mais informações, consulte Policies properties. |
|
PolicyAttachments |
Map |
Não |
Sim |
Nomes das políticas de sistema e personalizadas a serem anexadas. |
Para mais informações, consulte PolicyAttachments properties. |
Sintaxe de Policies
"Policies": [
{
"Description": String,
"PolicyName": String,
"PolicyDocument": Map,
"IgnoreExisting": Boolean
}
]
Propriedades de Policies
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrições |
|
PolicyDocument |
Map |
Sim |
Sim |
Documento da política. |
O documento pode ter até 2.048 caracteres. Para obter detalhes sobre os elementos e exemplos de uma política de acesso, consulte Basic elements of an access policy e Overview of the access policy example library. Para mais informações, consulte PolicyDocument properties. |
|
PolicyName |
String |
Sim |
Não |
Nome da política de acesso. |
O nome deve ter de 1 a 128 caracteres e pode conter letras, dígitos e hifens (-). |
|
Description |
String |
Não |
Não |
Descrição da política. |
A descrição deve ter de 1 a 1.024 caracteres. |
|
IgnoreExisting |
Boolean |
Não |
Não |
Indica se políticas existentes devem ser ignoradas. |
Valores válidos:
|
Sintaxe de PolicyDocument
"PolicyDocument": {
"Version": String,
"Statement": List
}
Propriedades de PolicyDocument
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrições |
|
Statement |
List |
Sim |
Não |
Regras da política de acesso. |
Para mais informações, consulte Statement properties. |
|
Version |
String |
Sim |
Não |
Versão da política de acesso. |
Nenhuma |
Sintaxe de Statement
"Statement": [
{
"Condition": Map,
"Action": List,
"Resource": List,
"Effect": String,
"NotAction": List
}
]
Propriedades de Statement
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrições |
|
Action |
List |
Não |
Não |
Operações às quais a política de acesso se aplica. |
Nenhuma |
|
Condition |
Map |
Não |
Não |
Condições necessárias para que a autorização entre em vigor. |
Nenhuma |
|
Effect |
String |
Não |
Não |
Efeito da autorização. |
Valores válidos:
|
|
NotAction |
List |
Não |
Não |
Operações específicas excluídas quando Allow ou Deny entra em vigor. |
Nenhuma |
|
Resource |
List |
Não |
Não |
Recursos aos quais a política de acesso se aplica. |
Nenhuma |
Sintaxe de PolicyAttachments
"PolicyAttachments": {
"System": List,
"Custom": List
}
Propriedades de PolicyAttachments
|
Propriedade |
Tipo |
Obrigatória |
Editável |
Descrição |
Restrições |
|
Custom |
List |
Não |
Sim |
Lista de nomes de políticas personalizadas. |
O número máximo de políticas é 5. |
|
System |
List |
Não |
Sim |
Lista de nomes de políticas de sistema. |
O número máximo de políticas é 20. |
Valores de retorno
Fn::GetAtt
GroupName: Nome do grupo de usuários do RAM.
Exemplos
Cenário 1: Crie um grupo do RAM com políticas de sistema para controle de acesso somente leitura da equipe.
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"
]
}
}
}
}Cenário 2: Crie um grupo do RAM com políticas personalizadas inline para controle de acesso granular.
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"
]
}
}
}
}Cenário 3: Crie um grupo do RAM com políticas de sistema e personalizadas para controle de acesso híbrido.
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"
]
}
}
}
}