资源编排服务ROS(Resource Orchestration Service)支持通过创建资源栈的方式快速创建RAM用户并为RAM用户授权。
背景信息
当您使用RAM控制台创建RAM用户,并为RAM用户授权时,需要多个操作步骤,而ROS可以帮助您快速完成此操作,提升效率。关于RAM用户的更多信息,请参见RAM用户概览。
步骤一:编辑模板
通过以下模板创建RAM用户、创建自定义策略、创建访问密钥AK(AccessKey)及为RAM用户授权。
关于资源类型的更多信息,请参见资源类型索引。
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
UserName:
Type: String
Description: RAM User Name
Label:
en: RAM User Name
PolicyName:
Type: String
Description: RAM Policy Name
Label:
en: RAM Policy Name
Action:
Default:
- vpc:*
Type: Json
Description:
en: The operation of products and services defined by the strategy, Resources for operations, refer to <a href='https://www.alibabacloud.com/help/doc-detail/93738.htm'>Policy elements</a> for more info.
Label:
en: PolicyAction
Effect:
Default: Allow
AllowedValues:
- Allow
- Deny
Type: String
Description:
en: Allow/Deny Action for Resource
Label:
en: Authority
Resource:
Default:
- '*'
Type: Json
Description:
en: Resources for operations, refer to <a href='https://www.alibabacloud.com/help/doc-detail/93738.htm'>Policy elements</a> for more info.
Label:
en: Resource
Resources:
ManagedPolicy:
Type: ALIYUN::RAM::ManagedPolicy
Properties:
PolicyName:
Ref: PolicyName
PolicyDocument:
Version: '1'
Statement:
- Action:
Ref: Action
Resource:
Ref: Resource
Effect:
Ref: Effect
RamAK:
Type: ALIYUN::RAM::AccessKey
Properties:
UserName:
Fn::GetAtt:
- RamUser
- UserName
DependsOn: RamUser
RamUser:
Type: ALIYUN::RAM::User
Properties:
UserName:
Ref: UserName
AttachPolicyToUser:
DependsOn:
- ManagedPolicy
- RamUser
Type: ALIYUN::RAM::AttachPolicyToUser
Properties:
PolicyType: Custom
UserName:
Fn::GetAtt:
- RamUser
- UserName
PolicyName:
Fn::GetAtt:
- ManagedPolicy
- PolicyName
Outputs:
AKSecret:
Value:
Fn::GetAtt:
- RamAK
- AccessKeySecret
AKId:
Value:
Fn::GetAtt:
- RamAK
- AccessKeyId
UserId:
Value:
Fn::GetAtt:
- RamUser
- UserId