-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ecs): grant drain-hook policy container-instance permissions #3196
Conversation
UpdateContainerInstanceState and ListTask APIs require permissions on a container-instance resource, rather than a cluster resource. This change updates the policy to: 1. remove the cluster as the resource restriction 2. add the cluster as a resource condition More info on ECS Resource-Level permissions can be found here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-supported-iam-actions-resources.html Fixes aws#3190
Good buddy @pkandasamy91 - mind taking a look? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kohidave welcome! Was this closed intentionally? |
], | ||
resources: [props.cluster.clusterArn] | ||
})); | ||
|
||
// Restrict to the container-instance operations to the ECS Cluster |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Restrict to the container-instance operations to the ECS cluster"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
conditions: { | ||
ArnEquals: {'ecs:cluster': props.cluster.clusterArn} | ||
}, | ||
resources: ['*'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just making sure: does it make sense to use "*" here and not a specific resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does because otherwise, the resource would need to be the container instance id, but it doesn't make sense in the case of instances that are scaled up or down, as instance ids can change frequently.
As per https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-supported-iam-actions-resources.html, we used the ecs:cluster condition key instead.
UpdateContainerInstanceState and ListTask APIs require permissions on
a container-instance resource, rather than a cluster resource. This
change updates the policy to:
More info on ECS Resource-Level permissions can be found here:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-supported-iam-actions-resources.html
Fixes #3190
Please read the contribution guidelines and follow the pull-request checklist.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license