Skip to content

Commit 0c9cfdd

Browse files
authored
Merge pull request #302 from silinternational/policy-refinement
revise the recommended IAM policy to limit access
2 parents e90a62c + dcb7cbf commit 0c9cfdd

File tree

1 file changed

+55
-14
lines changed

1 file changed

+55
-14
lines changed

README.md

+55-14
Original file line numberDiff line numberDiff line change
@@ -184,24 +184,65 @@ Here's an example of a suitable custom policy for [AWS IAM](https://aws.amazon.c
184184

185185
```json
186186
{
187-
"Version": "2012-10-17",
187+
"Version": "2012-10-17",
188+
"Statement": [
189+
{
190+
"Action": [
191+
"ecs:DescribeServices",
192+
"ecs:UpdateService",
193+
"ecs:RegisterTaskDefinition",
194+
"ecs:DescribeTasks",
195+
"ecs:ListTasks"
196+
],
197+
"Effect": "Allow",
198+
"Resource": [
199+
"arn:aws:ecs:us-east-1:111111111111:service/cluster-name/service-name",
200+
"arn:aws:ecs:us-east-1:111111111111:task-definition/service-name:*",
201+
"arn:aws:ecs:us-east-1:111111111111:task/cluster-name/*",
202+
"arn:aws:ecs:us-east-1:111111111111:container-instance/cluster-name/*"
203+
]
204+
},
205+
{
206+
"Action": [
207+
"ecs:DescribeTaskDefinition",
208+
"ecs:DeregisterTaskDefinition",
209+
"ecs:ListTaskDefinitions",
210+
"ecr:GetAuthorizationToken"
211+
],
212+
"Effect": "Allow",
213+
"Resource": "*"
214+
},
215+
{
216+
"Action": "iam:PassRole",
217+
"Effect": "Allow",
218+
"Resource": "arn:aws:iam::111111111111:role/role-name"
219+
}
220+
]
221+
}
222+
```
223+
224+
Replace the `111111111111` value with your AWS account number. The `iam:PassRole` action can be omitted if your task definition does not specify an ECS task role. If you do not use ECR, the `ecr:GetAuthorizationToken` action can be omitted.
225+
226+
Your ECR policy should limit access to the user or role used for ecs-deploy. Here is an example policy:
227+
228+
```json
229+
{
230+
"Version": "2008-10-17",
188231
"Statement": [
189232
{
190233
"Effect": "Allow",
234+
"Principal": {
235+
"AWS": "arn:aws:iam::111111111111:user/user-name"
236+
},
191237
"Action": [
192-
"ecs:DeregisterTaskDefinition",
193-
"ecs:DescribeServices",
194-
"ecs:DescribeTaskDefinition",
195-
"ecs:DescribeTasks",
196-
"ecs:ListTasks",
197-
"ecs:ListTaskDefinitions",
198-
"ecs:RegisterTaskDefinition",
199-
"ecs:StartTask",
200-
"ecs:StopTask",
201-
"ecs:UpdateService",
202-
"iam:PassRole"
203-
],
204-
"Resource": "*"
238+
"ecr:BatchCheckLayerAvailability",
239+
"ecr:BatchGetImage",
240+
"ecr:CompleteLayerUpload",
241+
"ecr:GetDownloadUrlForLayer",
242+
"ecr:InitiateLayerUpload",
243+
"ecr:PutImage",
244+
"ecr:UploadLayerPart"
245+
]
205246
}
206247
]
207248
}

0 commit comments

Comments
 (0)