Book Image

Amazon Fargate Quick Start Guide

By : Deepak Vohra
Book Image

Amazon Fargate Quick Start Guide

By: Deepak Vohra

Overview of this book

Amazon Fargate is new launch type for the Amazon Elastic Container Service (ECS). ECS is an AWS service for Docker container orchestration. Docker is the de facto containerization framework and has revolutionized packaging and deployment of software. The introduction of Fargate has made the ECS platform serverless. The book takes you through how Amazon Fargate runs ECS services composed of tasks and Docker containers and exposes the containers to the user. Fargate has simplified the ECS platform. We will learn how Fargate creates an Elastic Network Interface (ENI) for each task and how auto scaling can be enabled for ECS tasks. You will also learn about using an IAM policy to download Docker images and send logs to CloudWatch. Finally, by the end of this book, you will have learned about how to use ECS CLI to create an ECS cluster and deploy tasks with Docker Compose.
Table of Contents (14 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

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...