-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPrerequisites.yaml
278 lines (278 loc) · 8.54 KB
/
Prerequisites.yaml
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
277
278
AWSTemplateFormatVersion: 2010-09-09
Resources:
TeamRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: TeamRole
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
AWS:
- !Sub
- 'arn:aws:iam::${AccountId}:root'
- { AccountId: !Ref 'AWS::AccountId' }
Service:
- quicksight.amazonaws.com
- sagemaker.amazonaws.com
- amplify.amazonaws.com
- robomaker.amazonaws.com
- ecs-tasks.amazonaws.com
- cloudtrail.amazonaws.com
- cloud9.amazonaws.com
- codecommit.amazonaws.com
- lambda.amazonaws.com
- ec2.amazonaws.com
- glue.amazonaws.com
- cloudformation.amazonaws.com
- ecs.amazonaws.com
- eks.amazonaws.com
- cloudwatch.amazonaws.com
- dynamodb.amazonaws.com
- rds.amazonaws.com
- deepracer.amazonaws.com
Action:
- 'sts:AssumeRole'
BasicTeamRolePolicy:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: BasicTeamRolePolicy
Roles:
- !Ref TeamRole
PolicyDocument:
Version: 2012-10-17
Statement:
- Sid: OverlyPermissivePolicy
Effect: Allow
Action:
- athena:*
- apigateway:*
- appmesh:*
- amplify:*
- application-autoscaling:*
- autoscaling:*
- cloud9:*
- cloudformation:*
- cloudfront:*
- cloudtrail:*
- cloudwatch:*
- codebuild:*
- codecommit:*
- codedeploy:*
- codepipeline:*
- codestar:*
- cognito-identity:*
- cognito-idp:*
- cognito-sync:*
- comprehendmedical:*
- comprehend:*
- config:*
- dynamodb:*
- ec2messages:*
- ecr:*
- ecs:*
- eks:*
- elasticmapreduce:*
- elasticbeanstalk:*
- elasticloadbalancing:*
- es:*
- events:*
- firehose:*
- glue:*
- greengrass:*
- iam:CreateServiceLinkedRole
- iam:Generate*
- iam:Get*
- iam:List*
- iam:ListRoles
- iot:*
- iotanalytics:*
- iotevents:*
- kinesis:*
- kinesisanalytics:*
- kms:*
- lambda:*
- logs:*
- medialive:*
- mediapackage:*
- rds:*
- redshift:*
- resource-groups:*
- s3:*
- sagemaker:*
- sns:*
- sqs:*
- ssm:*
- ssmmessages:*
- states:*
- tag:*
- translate:*
- waf:*
- xray:*
- deepracer:*
- robomaker:*
Resource: '*'
- Sid: DenyXXLInstances
Effect: Deny
Action: ec2:RunInstances
Resource:
- arn:aws:ec2:*:*:instance/*
Condition:
StringLike:
ec2:InstanceType:
- "*6xlarge"
- "*8xlarge"
- "*10xlarge"
- "*12xlarge"
- "*16xlarge"
- "*18xlarge"
- "*24xlarge"
- f1.4xlarge
- x1*
- z1*
- "*metal"
- Sid: AllowAllOtherEC2ActionsExceptSpotAndReserved
Effect: Allow
Action:
- ec2:Accept*
- ec2:Allocate*
- ec2:Assign*
- ec2:Associate*
- ec2:Attach*
- ec2:Authorize*
- ec2:Bundle*
- ec2:Cancel*
- ec2:Confirm*
- ec2:Copy*
- ec2:Create*
- ec2:Delete*
- ec2:Deregister*
- ec2:Describe*
- ec2:Detach*
- ec2:Disable*
- ec2:Disassociate*
- ec2:Enable*
- ec2:Get*
- ec2:Import*
- ec2:Modify*
- ec2:Monitor*
- ec2:Move*
- ec2:Reboot*
- ec2:Register*
- ec2:Reject*
- ec2:Release*
- ec2:Replace*
- ec2:Report*
- ec2:Reset*
- ec2:Restore*
- ec2:Revoke*
- ec2:Run*
- ec2:Start*
- ec2:Stop*
- ec2:Terminate*
- ec2:Unassign*
- ec2:Unmonitor*
- ec2:Search*
Resource: "*"
- Sid: DontBuyReservationsOrSpotPlz
Effect: Deny
Action:
- ec2:ModifyReservedInstances
- ec2:PurchaseHostReservation
- ec2:PurchaseReservedInstancesOffering
- ec2:PurchaseScheduledInstances
- rds:PurchaseReservedDBInstancesOffering
- dynamodb:PurchaseReservedCapacityOfferings
- ec2:CancelSpotFleetRequests
- ec2:ModifySpotFleetRequest
- ec2:RequestSpotFleet
- ec2:RequestSpotInstances
- ec2:CancelSpotInstanceRequests
- ec2:CreateSpotDatafeedSubscription
- ec2:DeleteSpotDatafeedSubscription
Resource: "*"
- Sid: PassRole
Effect: Allow
Action: iam:PassRole
Resource:
- !Sub
- 'arn:aws:iam::${AccountId}:role/${TeamRole}'
- { AccountId: !Ref 'AWS::AccountId', TeamRole: !Ref TeamRole }
RestrictTeamRolePolicy:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: RestrictTeamRolePolicy
Roles:
- !Ref TeamRole
PolicyDocument:
Version: 2012-10-17
Statement:
- Sid: AllowIAMRO
Effect: Allow
Action:
- iam:List*
- iam:Get*
- iam:Generate*
- sts:GetCallerIdentity
Resource: "*"
- Effect: Allow
Action: iam:CreateServiceLinkedRole
Resource: arn:aws:iam::*:role/aws-service-role/*
- Effect: Allow
Action:
- iam:PassRole
Resource:
- !Sub
- 'arn:aws:iam::${AccountId}:role/${TeamRole}'
- { AccountId: !Ref 'AWS::AccountId', TeamRole: !Ref TeamRole }
- Sid: DenyBlacklist
Effect: Deny
Action:
- route53domains:*
- ec2:ModifyReservedInstances
- ec2:PurchaseHostReservation
- ec2:PurchaseReservedInstancesOffering
- ec2:PurchaseScheduledInstances
- rds:PurchaseReservedDBInstancesOffering
- dynamodb:PurchaseReservedCapacityOfferings
- s3:PutObjectRetention
- s3:PutObjectLegalHold
- s3:BypassGovernanceRetention
- s3:PutBucketObjectLockConfiguration
Resource: "*"
- Sid: DenyAllOutsideTargetRegion
Effect: Deny
NotAction:
- iam:*
- sts:*
- s3:*
- ds:*
- quicksight:*
- cloudfront:*
- route53:*
- servicediscovery:*
- waf:*
- waf-regional:*
- cloudwatch:DescribeAlarms
- cloudwatch:PutMetricAlarm
- cloudwatch:DeleteAlarms
- cloudwatch:GetMetricStatistics
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
- ecr:BatchCheckLayerAvailability
- ecr:GetAuthorizationToken
- globalaccelerator:*
- acm:List*
- acm:Describe*
- kms:Describe*
- kms:ReEncrypt*
- kms:Get*
- kms:List*
- kms:CreateGrant
- kms:RevokeGrant
Resource: "*"
Condition:
StringNotEquals:
aws:RequestedRegion:
- eu-west-1