forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsingle-user-with-different-policies.yml
276 lines (276 loc) · 6.72 KB
/
single-user-with-different-policies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建子账户,分配至用户组与管理员组,启用登录,生成访问密钥,附带读取ECS和OSS权限策略。
en: Create sub-accounts, allocate them to user groups and administrator groups,
enable login functionality, generate access keys, and attach read-only policies
for Elastic Compute Service (ECS) and Object Storage Service (OSS).
Parameters:
GroupName1:
Type: String
Label:
en: Group 1 Name
zh-cn: 用户组1的名称
Description:
en: The name of user group 1, <br>Specifies the group name, containing up to
64 characters,English letters, Numbers, or '-' are allowed.
zh-cn: 用户组1的名称,指定最多包含64个字符、英文字母、数字或“-”的组名。
ConstraintDescription:
en: No more than 64 characters,English letters, Numbers, or '-' are allowed.
zh-cn: 不得超过 64 个字符、英文字母、数字或'-'。
Default: UserGroup
AllowedPattern: ^[a-zA-Z0-9\-]+$
MinLength: 1
MaxLength: 64
GroupName2:
Type: String
Label:
en: Group 2 Name
zh-cn: 用户组2的名称
Description:
en: The name of user group 2, <br>Specifies the group name, containing up to
64 characters,English letters, Numbers, or '-' are allowed.
zh-cn: 用户组2的名称,指定最多包含64个字符、英文字母、数字或“-”的组名。
ConstraintDescription:
en: No more than 64 characters,English letters, Numbers, or '-' are allowed.
zh-cn: 不得超过 64 个字符、英文字母、数字或'-'。
Default: AdminGroup
AllowedPattern: ^[a-zA-Z0-9\-]+$
MinLength: 1
MaxLength: 64
UserName:
Type: String
Label:
en: User Name
zh-cn: 用户名称
Description:
en: The user name cannot already exist,<br>Contains english letters, numbers,'.'
, '_' or '-', not more than 64 characters.
zh-cn: 不能是已经存在的用户名,<br>用户名可包含英文字母,数字,'.', '_'或'-',不超过64个字符。
ConstraintDescription:
en: No more than 64 characters,English letters, Numbers, or '-' are allowed.
zh-cn: 不得超过 64 个字符、英文字母、数字或'-'。
Default: test-user
AllowedPattern: '[a-zA-Z0-9\.\-\_]+$'
MinLength: 1
MaxLength: 64
UserPassword:
Type: String
Label:
en: User Password
zh-cn: 用户密码
Description:
en: Specify a password, which must meet the password strength requirements;<br>About
password strength policy, Please refer to the <a href='https://help.aliyun.com/document_detail/28740.html'
target='_blank'><b><font color='blue'>GetPasswordPolicy</font></b><font color='blue'></a>.
zh-cn: 指定密码,必须满足密码强度要求;关于密码强度策略,请参阅<a href='https://help.aliyun.com/document_detail/28740.html'
target='_blank'><b><font color='blue'>GetPasswordPolicy</font></b><font color='blue'></a>。
NoEcho: true
Resources:
RamGroup1:
Type: ALIYUN::RAM::Group
Properties:
GroupName:
Ref: GroupName1
RamGroup2:
Type: ALIYUN::RAM::Group
Properties:
GroupName:
Ref: GroupName2
RamUser:
Type: ALIYUN::RAM::User
Properties:
Groups:
- Ref: RamGroup1
- Ref: RamGroup2
LoginProfile:
Password:
Ref: UserPassword
PasswordResetRequired: false
UserName:
Ref: UserName
RamAK:
Type: ALIYUN::RAM::AccessKey
Properties:
UserName:
Fn::GetAtt:
- RamUser
- UserName
RamManagedPolicy1:
Type: ALIYUN::RAM::ManagedPolicy
Properties:
Groups:
- Ref: RamGroup1
PolicyDocument:
Statement:
- Action:
- ecs:Describe*
Effect: Allow
Resource:
- '*'
- Action:
- ecs:List*
Effect: Allow
Resource:
- '*'
- Action:
- vpc:DescribeVpcs
- vpc:DescribeVSwitches
Effect: Allow
Resource:
- '*'
Version: '1'
PolicyName:
Fn::Join:
- '-'
- - ECSReadOnly
- StackId
- Ref: ALIYUN::StackId
RamManagedPolicy2:
Type: ALIYUN::RAM::ManagedPolicy
Properties:
Groups:
- Ref: RamGroup2
PolicyDocument:
Statement:
- Action:
- oss:*
Effect: Allow
Resource:
- '*'
Version: '1'
PolicyName:
Fn::Join:
- '-'
- - OSSReadOnly
- StackId
- Ref: ALIYUN::StackId
Outputs:
RamAccessKeyId:
Value:
Fn::GetAtt:
- RamAK
- AccessKeyId
RamUserId:
Value:
Fn::GetAtt:
- RamUser
- UserId
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- GroupName1
- GroupName2
- UserName
- UserPassword
Label:
default: RAM
TemplateTags:
- acs:example:弹性计算:创建具有不同策略的用户组的用户
ALIYUN::ROS::Composer:
'98374557':
Res:
- RamUser
Parent: 832d2b53
Rect:
- 40
- 40
- 79
- 261
- 12
- 0
Layer:
- f5731c43
- 2c18afe4
7dbd9427:
Rect:
- 500
- 426
- -156
- 45
- 1
- 0
ResT: Composer::ROSParameter::AlibabaCloud
832d2b53:
Parent: 7dbd9427
Rect:
- 441
- 360
- -114
- 87
- 2
- 0
ResT: Composer::ROSParameter::Region
40179b7b:
Res:
- RamAK
Parent: 832d2b53
Rect:
- 40
- 40
- 79
- 127
- 3
- 0
13bfc812:
Res:
- RamManagedPolicy1
Parent: 832d2b53
Rect:
- 40
- 40
- 259
- 261
- 3
- 0
d32732fd:
Res:
- RamManagedPolicy2
Parent: 832d2b53
Rect:
- 40
- 40
- -80
- 287
- 3
- 0
f5731c43:
Res:
- RamGroup2
Parent: 832d2b53
Rect:
- 163
- 139
- -10
- 237
- 10
- 0
2c18afe4:
Res:
- RamGroup1
Parent: 832d2b53
Rect:
- 151
- 142
- 55
- 210
- 11
- 0
a83ecf32:
Parent: 832d2b53
Edge:
- 40179b7b
- '98374557'
Line: 0:0:0:gray:0
ebd17a93:
Parent: 832d2b53
Edge:
- 13bfc812
- 2c18afe4
Line: 0:0:0:gray:0
a17f48a4:
Parent: 832d2b53
Edge:
- d32732fd
- f5731c43
Line: 0:0:0:gray:0