Terraform on AWS: Nonprod and Production Environments · Identity and Data: IAM, S3 and RDS

IAM Roles: Execution Role, Task Role and Least Privilege

Write separate IAM roles for the ECS execution role (what ECS needs to start the task) and the task role (what your application code is allowed to do), using aws_iam_policy_document for type-safe, reviewable policies.

Members can save this page, take notes and track progress. See membership · Sign in

What you'll build

Two IAM roles for an ECS Fargate service: an execution role that ECS uses to pull the container image and write logs, and a task role that the application code assumes at runtime to call AWS services. Each role's policies are defined with aws_iam_policy_document data source blocks, which are evaluated locally (no AWS API call needed).

Premium course

Keep reading with a membership

The rest of this lesson, its practice questions and the whole Terraform on AWS: Nonprod and Production Environments course are part of the membership.

See plans Sign in

Open in the app to mark lessons complete, take notes and track your progress.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake