

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: VPC and Networking Setup
incomplete
2: Why ECS?
incomplete
3: Elastic Container Registry
incomplete
4: ECR Repo
incomplete
5: ECS Clusters
incomplete
6: ECS Permissions
incomplete
7: ECS Task Definitions
incomplete
8: ECS Security Groups
incomplete
9: Application Load Balancer
incomplete
10: Target Groups
incomplete
11: CloudWatch Log Groups
incomplete
12: ECS Services
incomplete
13: Cleanup
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We've dealt with IAM roles with EC2, but they also apply to ECS. We have two problems to solve:
Two different permission sets, and AWS handles them with:
I've met a lot of engineers confused about this concept, and it's partly because AWS tries to be helpful and "create" roles automatically... sometimes.
So an engineer might have tasks running happily for quite a while before they need to think about what roles/permissions they need to give to their tasks.
AWS will happily suggest creating the roles for you in the console, but we'll do it by hand so you can see exactly what's going on.
Remember, every IAM Role has a set of Permissions (what can be done) and a Trust Policy (who can use it).
Create the IAM roles and policies needed for ECS tasks.
Cost check: IAM roles and policies are free. You only pay for the resources that use these roles.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": ["logs:CreateLogStream", "logs:PutLogEvents"],
"Resource": "arn:aws:logs:*:*:log-group:/ecs/patientping-ecs:*"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ReadSsmParameters",
"Effect": "Allow",
"Action": ["ssm:GetParameter", "ssm:GetParameters"],
"Resource": ["arn:aws:ssm:us-east-1:*:parameter/CMO_NAME"]
}
]
}
Run and submit the tests to verify your IAM roles are configured correctly.