Skip to content

Instantly share code, notes, and snippets.

@lalitkale
Last active February 22, 2021 15:48
Show Gist options
  • Save lalitkale/b0cefaa5ec9df6a4438b35feff900ec9 to your computer and use it in GitHub Desktop.
Save lalitkale/b0cefaa5ec9df6a4438b35feff900ec9 to your computer and use it in GitHub Desktop.
ECS Roles

ECS Role Types

Host Role

When running ECS on EC2, the EC2 instances hosting the containers need a role. This role gives them permission to, among other things, pull images from ECR, manage tasks in the ECS API, and put logs into cloudwatch.

Task Execution Role

When running in Fargate, there are no EC2 instances hosting your containers, so these permissions have to go somewhere. This is called a Task Execution Role. It gives the Fargate service the same permissions the EC2 instance would need. This role is not required when running tasks on EC2 backed ECS.

ECS Service-Linked Role

This is a role used by the ECS service itself to perform functions such as managing load balancer configuration, doing service discovery, as well as attaching network interfaces when using the awsvpc network mode. There is only one of these per account.

ECS Task Role (or Container Role)

Not to be confused with the Task Execution Role, the Task Role is used when code running inside the container needs access to AWS resources. This is equivalent to the instance profile if the code was running directly on an EC2 instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment