AWS Elastic Container Service
8 December, 2022
3
3
0
Contributors
Understanding AWS-ECS:
What is ECS?
ECS Vs Others
ECS Infrastructure
ECS launch types
1.
EC2 launch type: This launch type allows you to run your containers on a cluster of Amazon Elastic Compute Cloud (EC2) instances that you manage. This gives you full control over the underlying infrastructure and allows you to use your own custom AMIs, configure autoscaling, and integrate with other AWS services.
2.
Fargate launch type: This launch type allows you to run your containers without the need to manage any infrastructure. Fargate automatically provisions and scales the underlying infrastructure required to run your containers, so you can focus on building and running your applications.
EC2 Vs Fargate
•
•
•
•
ECS Task
ECS Services
ECS LoadBalancers
In Amazon Elastic Container Service (ECS), a load balancer is a network service that distributes incoming traffic across multiple tasks or containers in a cluster. This allows you to scale your applications horizontally and ensure that they can handle a large number of requests without becoming overwhelmed.
ECS supports two types of load balancers:
Classic load balancers: These are the traditional load balancers in AWS that use a round-robin algorithm to distribute traffic across multiple targets. Classic load balancers can be used with both the EC2 and Fargate launch types in ECS.
Application load balancers: These are the more advanced load balancers in AWS that support features such as path-based routing and central certificate management. Application load balancers can only be used with the EC2 launch type in ECS.
To use a load balancer with your ECS tasks, you need to create a load balancer in AWS and then specify the load balancer's target group in the task definition for your service. ECS will then automatically register your tasks as targets in the target group and start routing traffic to them.
Overall, load balancers are an important component of an ECS infrastructure, as they help distribute traffic across your tasks and ensure that your applications can handle a large number of requests.
Working with AWS ECS
1.
Sign up for an AWS account: If you don't already have an AWS account, you can sign up for one at https://aws.amazon.com/.
2.
Install the AWS CLI: The AWS Command Line Interface (CLI) is a tool that you can use to manage your AWS resources from the command line. You can install the AWS CLI by following the instructions here: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
3.
Create an IAM user: IAM (Identity and Access Management) is the service in AWS that allows you to manage users and permissions. You will need to create an IAM user with the appropriate permissions to access ECS. You can do this by following the instructions here: https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started.html
4.
Create an ECS cluster: An ECS cluster is a logical group of EC2 instances or Fargate tasks that you use to run your containerized applications. You can create a cluster by following the instructions here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create_cluster.html
5.
Create a task definition: A task definition is a JSON or YAML file that specifies the containers that make up your task, the resources required to run the task (e.g., CPU, memory), and any other relevant configuration settings. You can create a task definition by following the instructions here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-task-definition.html
6.
Run a task: Once you have created a task definition, you can use it to run a task on your ECS cluster. You can do this by following the instructions here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/run-task.html
task-definition.json
), and then use the aws ecs register-task-definition
command to register the task definition with your ECS cluster. For example:aws ecs list-tasks
command.task-definition.yml
), and then use the aws ecs register-task-definition
command to register the task definition with your ECS cluster. For example:aws ecs list-tasks
command.