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.
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.
Open in the app to mark lessons complete, take notes and track your progress.