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

Granting security group Ingress


Next, add a security group rule to allow inbound access on port 80 with the Grant-EC2SecurityGroupIngress cmdlet, using the following commands run in the sequence listed:

$ip1 = new-object Amazon.EC2.Model.IpPermission
$ip1.IpProtocol = "tcp"
$ip1.FromPort = 80
$ip1.ToPort = 80
$ip1.IpRanges.Add("0.0.0.0/0")
Grant-EC2SecurityGroupIngress -GroupId $groupid -Region "us-east-1" -IpPermissions @($ip1)

Subsequently, run the Get-EC2SecurityGroup cmdlet again and, as the output here indicates, the Ingress permissions get set on the EC2 security group:

We shall be creating an ECS task for WordPress only, but if a MySQL database is also to be configured in the same task, we would also need to add an ingress rule for port 3306, which is exposed by the MySQL database. Run the following commands in the sequence listed to add ingress for port 3306:

$ip2 = new-object Amazon.EC2.Model.IpPermission
$ip2.IpProtocol = "tcp"
$ip2.FromPort = 3306
$ip2.ToPort = 3306
$ip2.IpRanges...