Skip to content

IAM Roles Overview

ECS Express Mode requires three distinct IAM roles, each with a specific trust relationship and purpose. This separation follows the principle of least privilege — each role grants only the permissions needed for its specific function.

The Task Execution Role
An IAM role assumed by ecs-tasks.amazonaws.com that grants ECS permissions to pull container images and write CloudWatch logs.
handles container lifecycle operations, the Infrastructure Role
An IAM role assumed by ecs.amazonaws.com that grants ECS Express Mode permissions to provision ALB, networking, and auto scaling resources.
grants ECS permission to provision and manage load balancing and scaling resources, and the Task Role
An IAM role assumed by ecs-tasks.amazonaws.com that grants the running container application-level permissions (Bedrock access in this project).
provides application-level permissions to the running container.

Role NameTrusted PrincipalPurpose
Task Execution Role
An IAM role assumed by ecs-tasks.amazonaws.com that grants ECS permissions to pull container images and write CloudWatch logs.
ecs-tasks.amazonaws.comPulls container images from ECR and writes logs to CloudWatch
Infrastructure Role
An IAM role assumed by ecs.amazonaws.com that grants ECS Express Mode permissions to provision ALB, networking, and auto scaling resources.
ecs.amazonaws.com

Provisions and manages ALB, networking, and auto scaling resources for Express Mode

Task Role
An IAM role assumed by ecs-tasks.amazonaws.com that grants the running container application-level permissions (Bedrock access in this project).
ecs-tasks.amazonaws.com

Grants the running container application-level permissions (Bedrock access in this project)

Each role has an assume-role policy that restricts which AWS service principal can use it. Two principals are involved:

  • ecs-tasks.amazonaws.com — assumed by the ECS task agent for both the Task Execution Role
    An IAM role assumed by ecs-tasks.amazonaws.com that grants ECS permissions to pull container images and write CloudWatch logs.
    (container lifecycle) and the Task Role
    An IAM role assumed by ecs-tasks.amazonaws.com that grants the running container application-level permissions (Bedrock access in this project).
    (application permissions)
  • ecs.amazonaws.com — assumed by the ECS control plane for the Infrastructure Role
    An IAM role assumed by ecs.amazonaws.com that grants ECS Express Mode permissions to provision ALB, networking, and auto scaling resources.
    (provisioning Express Mode resources)

Each role is documented in detail on its own page with full HCL from the source repository: