-
Notifications
You must be signed in to change notification settings - Fork 30
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
9.1.0 - IAM role management #395
Conversation
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.
LGTM the only thing is the question on whether we want to default to creating a role if one is not provided.
@@ -233,7 +233,7 @@ const Resources = { | |||
Owner: 'mapbox', | |||
Repo: 'ecs-watchbot', | |||
PollForSourceChanges: 'false', | |||
Branch: 'master', | |||
Branch: 'mapsam/iam-role-options', |
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.
9.x
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.
@@ -246,7 +247,7 @@ module.exports = (options = {}) => { | |||
Statement: [ | |||
{ | |||
Effect: 'Allow', | |||
Principal: { Service: ['ecs-tasks.amazonaws.com'] }, | |||
Principal: { Service: ['ecs-tasks.amazonaws.com', 'lambda.amazonaws.com'] }, |
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.
The roles created in ma-iam only had the service principal of ecs.amazonaws.com
. Will that cause issues when interacting with the lambdas and should we add that in?
Just wrapped up another round of testing and this time tested both a fargate setup and an ec2 cluster setup, both seem to work as expected: Fargate EC2 These are both using scaling roles that look like this: {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"application-autoscaling:*",
"cloudwatch:DescribeAlarms",
"cloudwatch:PutMetricAlarm",
"ecs:DescribeServices",
"ecs:UpdateService"
],
"Resource": "*",
"Effect": "Allow"
}
]
} And a trust policy using the principal |
What changed?
This is a change to the 9.x branch of ecs-watchbot that merges some of the IAM roles to reduce the number of roles created per stack. It allows the user to pass a pre-defined autoscaling role with the
options.autoscalingRoleArn
parameter, which enables a user to re-use a role throughout multiple stacks if they desire.options.autoscalingRoleArn
when building the templateDocs are included in the README to provide guidance on what permissions the auto-scaling role requires in order to work properly.
10.x vs. 9.x
Given ecs-watchbot has been migrated to a CDK stack in 10.x, this release focuses exclusively on a 9.x backport to support the most users. 10.x roles will be updated as well but in a separate release. The watchbot binaries are still being built by this branch and maintained by Mapbox.
Test binaries can be found at the following location:
Deploy test
I was able to create a new stack called
ecs-watchbot-iam-test-staging
successfully with the following configuration (some options are obfuscated):I verified the following:
Looking at metrics is a nice way to visually see the service scale out when messages are >0 and scale in when messages are <1. I sent 100 messages in bulk to the test service, then purged the queue after scale out was confirmed. Subsequently, the service scaled in.
Checklist
Complete the steps below before merge where applicable: