Setting up prerequisites for Fargate
In addition to configuring an ECS CLI profile, we need to set up the following prerequisites to create an ECS cluster with the FARGATE launch type:
- Create a task execution role
- Register the task execution policy
- Create the task execution role
A task execution role is required to be created for a Fargate task to be able to download a Docker image and send and save container logs in CloudWatch. Create an IAM policy, execution-assume-role.json
, in the C:\PowerShell\
directory, and copy and save the following JSON listing to the policy file:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "ecs-tasks.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
Create the task execution role with the following command in PowerShell:
New-IAMRole -RoleName ecsExecutionRole -AssumeRolePolicyDocument (Get-Content -Raw C:\PowerShell\execution-assume-role.json)
As the output from...