-
Notifications
You must be signed in to change notification settings - Fork 3
/
restricted-policy-doc-2.json5
281 lines (280 loc) · 9.2 KB
/
restricted-policy-doc-2.json5
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
279
280
281
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "cloudformation",
"Effect": "Allow",
"Action": [
"acm:AddTagsToCertificate",
// Add owner/stack related tags to Certificate
"acm:DescribeCertificate",
// Describe Certificate created by cf to check
// the certification status during activation
"acm:RequestCertificate",
// Requests ACM certificate for dwx
"autoscaling:DescribeScalingActivities",
// When dwx scales up/down AutoScalingGroups
// dwx must check ASG activity status
"ec2:CreateLaunchTemplate",
// LaunchTemplate creates EC2 instances used
// by DWX
"ec2:CreatePlacementGroup",
// Placement groups launch EC2 instances in
// physical proximity within same AZ
"ec2:CreateSecurityGroup",
// Create Security Groups for EC2 instance
"ec2:DescribeAccountAttributes",
// Lists attributes for customer account that
// might be needed by cf to get quotas like
// vpc-max-security-groups-per-interface
// and supported_platforms
"ec2:DescribeAvailabilityZones",
// DWX query executors deployed among 3
// availibility zones that need az info
"ec2:DescribeLaunchTemplates",
// Updates sshkey to get old sshkey info from
// ec2 Launch Template
"ec2:DescribeLaunchTemplateVersions",
// Update sshkey using old sshkey info from
// ec2 Launch Template Version
"ec2:DescribePlacementGroups",
// Describes specified placement groups created
// during activation
"ec2:DescribeSecurityGroups",
// Tags the eks security group to get cluster
// security group id
"ec2:RevokeSecurityGroupEgress",
// Revoke SecurityGroupEgress authorized by cf
"ec2:RevokeSecurityGroupIngress",
// Revoke SecurityGroupIngress authorized by cf
"ec2:RunInstances",
//Essential to run the EC2 instance
"ec2:DeleteLaunchTemplate",
// Delete LaunchTemplate created by cf
"ec2:DeletePlacementGroup",
// Delete Placement Groups created by cf
"elasticfilesystem:DescribeMountTargets",
// Called by CF while creating EFS
"elasticfilesystem:DescribeFileSystems",
// Called by CF while creating EFS
"rds:DescribeEngineDefaultParameters"
// Describes default parameters of RDS. Required for Cloudformation operations
],
"Resource": "*",
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
}
}
},
{
"Sid": "CFResourceTag",
"Resource": "*",
"Effect": "Allow",
"Action": [
"ec2:AuthorizeSecurityGroupEgress",
// Adds outbound rules to security group for
// use with VPC
"ec2:AuthorizeSecurityGroupIngress",
//A dds inbound rules to security group
// for use with VPC
"ec2:RevokeSecurityGroupEgress",
// Revoke SecurityGroupEgress authorized by cf
"ec2:RevokeSecurityGroupIngress",
// Revoke SecurityGroupIngress authorized by cf
"autoscaling:DeleteAutoScalingGroup",
// Delete sharedservices and compute
// autoscaling groups--created/deleted with
// cloudformation stack
"ec2:DeleteSecurityGroup",
// Delete NodeSecurityGroup,
// ClusterControlPlaneSecurityGroup,
// DB Security Group created via cf stack
"eks:DeleteCluster"
// Delete EKS cluster created via cf
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
},
"StringLike": {
"aws:ResourceTag/Cloudera-Resource-Name": "crn:cdp:*"
}
}
},
{
"Sid": "CFRequestTag",
"Resource": "*",
"Effect": "Allow",
"Action": [
"kms:TagResource",
// Add owner/stack related tags to kms
"logs:CreateLogGroup"
// Create/name cloudwatch log group
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
},
"StringLike": {
"aws:RequestTag/Cloudera-Resource-Name": "crn:cdp:*"
}
}
},
{
"Sid": "CFDatabase",
"Resource": [
"arn:aws:rds:*:*:db:env-*-dwx-stack-rds",
"arn:aws:rds:*:*:subgrp:env-*-dwx-stack-dbsubnetgroup-*",
"arn:aws:rds:*:*:pg:env-*-dwx-stack-rds-parameter-group"
],
"Effect": "Allow",
"Action": [
"rds:CreateDBInstance",
// The RDBS (postgres) created to store dwx
// cluster info during activation
"rds:CreateDBSubnetGroup",
// The DBSubnetGroup created during activation
"rds:DescribeDBSubnetGroups",
// Describe DBSubnetGroup instance created by cf
"rds:ListTagsForResource",
// Lists tags on RDS DBsubnetgroup. Required for Cloudformation operations
"rds:CreateDBParameterGroup",
// Required by Cloudformation to create RDS Parameter Group
"rds:DeleteDBParameterGroup",
// Required by Cloudformation to delete RDS Parameter Group
"rds:ModifyDBParameterGroup",
// Required by Cloudformation to modify RDS Parameter Group
"rds:DescribeDBParameterGroups"
// Required by Cloudformation to describe RDS Parameter Group
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
}
}
},
{
"Sid": "CFEksCluster",
"Resource": "arn:aws:eks:*:*:cluster/env-*-dwx-stack-eks",
"Effect": "Allow",
"Action": [
"eks:CreateCluster",
// Creates eks cluster upon activation
// that dwx can deploy resources on
"eks:DescribeCluster"
// DWX keeps track of eks cluster created
// during env activation
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
}
}
},
{
"Sid": "CFCloudwatch",
"Resource": "arn:aws:eks:*::log-group:/aws/eks/env-*-dwx-stack-eks/cluster:*",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
// Create log stream of log group that
// originates from monitored application
// or resource
"logs:DescribeLogStreams",
// List log streams for log groups
"logs:PutLogEvents",
// Upload log events to log stream
"logs:PutRetentionPolicy"
// Change number of days Cloudwatch retains
]
},
{
"Sid": "CFKeys",
"Resource": "*",
"Effect": "Allow",
"Action": [
"kms:CreateAlias",
// kms key id hard to recognize so an alias is
// created, e.g. "env-xxxxxx-dwx-stack-kms-key"
"kms:DeleteAlias",
// Delete the kms alias created by cf
"kms:DescribeKey",
// Describe the KMS key created during
// activation
"kms:EnableKeyRotation",
// Allow rotation of kms key after expiration
"kms:GenerateDataKey",
// Returns unique symmetric data key in plain
// text for use outside AWS KMS
"kms:GenerateDataKeyWithoutPlaintext",
// Return unique symmetric encrypted data key
// for use outside of AWS KMS
"kms:ScheduleKeyDeletion"
// Schedule deletion of KMS key, rotate to new
// key
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
}
}
},
{
"Sid": "CFFileSystem",
"Resource": "*",
"Effect": "Allow",
"Action": [
"elasticfilesystem:CreateMountTarget",
//Create 3 EFS mount targets for 3 AZs
"elasticfilesystem:DeleteFileSystem",
// Delete EFS file system during deactivation via cf
"elasticfilesystem:DeleteMountTarget"
// Delete all the 3 EFS mount targets
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
},
"StringLike": {
"aws:ResourceTag/clusterId": "env-*"
}
}
},
{
"Sid": "AllowSsmParams",
"Effect": "Allow",
"Action": [
"ssm:DescribeParameters",
"ssm:GetParameter",
"ssm:GetParameters",
"ssm:GetParameterHistory",
"ssm:GetParametersByPath"
// these set of permissions is used by cloudformation
// to obtain the latest AMI during stack create and upgrade
],
"Resource": [
"arn:aws:ssm:*:*:parameter/aws/service/eks/optimized-ami/*"
],
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
}
}
},
{
"Sid": "TagRoleRestriction",
"Effect": "Allow",
"Action": [
// used by Cloudformation to tag EKSServiceRole and NodeInstanceRole
"iam:TagRole"
],
"Resource": "*",
"Condition": {
"ForAnyValue:StringEquals": {
"aws:CalledVia": "cloudformation.amazonaws.com"
}
}
}
]
}