/
Attach task-execution role to task definition in Elastic Container Service

Attach task-execution role to task definition in Elastic Container Service

Step 1: Create the S3 Bucket

  1. Go to the Amazon S3 console.

  2. Click on "Create bucket".

  3. Enter a unique name for your bucket, for example, cmis-bucket.

  4. Choose the region for your bucket.

  5. Click "Next".

  6. Click "Next" and then "Create bucket".

Step 2: Create the IAM Role (ecs-task-role)

  1. Go to the AWS Management Console and navigate to the IAM service.

  2. Click on "Roles" in the left-hand menu.

  3. Click on "Create role".

  4. Choose "AWS service" as the type of trusted entity.

  5. Select "Elastic Container Service (ECS)" as the service that will use this role.

aws-01.png
aws-021.png

 

  1. Click "Next: Permissions".

  2. Search for and select the appropriate S3 permissions you want to grant to your ECS tasks. For example, you might choose AmazonS3FullAccess if you want read-only access to S3.

 

 

  1. Give your role a name, for example, ecs-task-role, and optionally provide a description.

  2. Click "Create role".

Step 3: Create an ECS Cluster

  1. Go to the Amazon ECS console.

  1. Click on "Clusters" in the left-hand menu.

  2. Click on "Create Cluster".

  3. Provide a name for your cluster, for example cluster1.

  4. Click "Create".

Step 4: Create a Task Definition with the IAM Role

  1. Go to the Amazon ECS console.

  2. Click on "Task Definitions" in the left-hand menu.

  3. Click on "Create new Task Definition".

 

  1. Choose a launch type compatibility Fargate.

  2. Configure your container settings (image, CPU, memory, etc.).

  3. Under "Task role", select the previously create role.

  1. Configure the rest of your task definition as needed.

  2. Click "Create".

Step 5: Run Your Task on ECS Cluster

  1. Go to the Amazon ECS console.

  2. Click on "Clusters" in the left-hand menu and select your cluster (cluster1).

  3. Click on the "Tasks" tab and then click "Run new Task".

  4. Select your task definition and click "Run Task".

  5. Follow the prompts to configure your task settings and run your task.

Now your ECS task will have the IAM role (ecs-task-role) assigned to it, which grants access to Amazon S3.

Related content

Credentials provider
Credentials provider
More like this
S3
More like this
OpenSearch (tC)
OpenSearch (tC)
Read with this
Using S3 managed content service (s3managedbucketsblobstore)
Using S3 managed content service (s3managedbucketsblobstore)
More like this
Supported S3 storage products and Content Services
Supported S3 storage products and Content Services
Read with this
Instance profile configuration in AWS
Instance profile configuration in AWS
More like this