AWS Elastic Container Service

AWS Elastic Container Service

#90 Days of DevOps Challenge - Day 48

What is ECS?

  • Elastic Container Service(ECS) is a fully-managed container orchestration service provided by Amazon Web Services (AWS). It allows you to run and manage Docker containers on a cluster of virtual machines (EC2 instances) without having to manage the underlying infrastructure.

  • With ECS, you can easily deploy, manage, and scale your containerized applications using the AWS Management Console, the AWS CLI, or the API. ECS supports both "Fargate" and "EC2 launch types", which means you can run your containers on AWS-managed infrastructure or your own EC2 instances.

  • ECS also integrates with other AWS services, such as Elastic Load Balancing, Auto Scaling, and Amazon VPC, allowing you to build scalable and highly available applications. Additionally, ECS has support for Docker Compose and Kubernetes, making it easy to adopt existing container workflows.

  • Overall, ECS is a powerful and flexible container orchestration service that can help simplify the deployment and management of containerized applications in AWS.

Difference between EKS and ECS?

EKS (Elastic Kubernetes Service) and ECS (Elastic Container Service) are both container orchestration platforms provided by Amazon Web Services (AWS). While both platforms allow you to run containerized applications in the AWS cloud, there are some differences between the two.

  1. Architecture: ECS is based on a centralized architecture, where there is a control plane that manages the scheduling of containers on EC2 instances. On the other hand, EKS is based on a distributed architecture, where the Kubernetes control plane is distributed across multiple EC2 instances.

  2. Kubernetes Support: EKS is a fully managed Kubernetes service, meaning that it supports Kubernetes natively and allows you to run your Kubernetes workloads on AWS without having to manage the Kubernetes control plane. ECS, on the other hand, has its orchestration engine and does not support Kubernetes natively.

  3. Scaling: EKS is designed to automatically scale your Kubernetes cluster based on demand, whereas ECS requires you to configure scaling policies for your tasks and services.

  4. Flexibility: EKS provides more flexibility than ECS in terms of container orchestration, as it allows you to customize and configure Kubernetes to meet your specific requirements. ECS is more restrictive in terms of the options available for container orchestration.

  5. Community: Kubernetes has a large and active open-source community, which means that EKS benefits from a wide range of community-driven development and support. ECS, on the other hand, has a smaller community and is largely driven by AWS itself.

In summary, EKS is a good choice if you want to use Kubernetes to manage your containerized workloads on AWS, while ECS is a good choice if you want a simpler, more managed platform for running your containerized applications.

Task: Set up ECS (Elastic Container Service) by setting up Nginx on ECS.

Step 1:- First we need to go to ECS Service and click on clusters-> Create cluster

Need to give cluster name, vpc and subnet

We are using Farget as Serverless and now Click on Create

Now we can see that the cluster is successfully created

If we go cloud formation and we see the logs of creating a cluster

After creation successfully it will look like below

Step 2:- Now we need to Create a task definition so for that we need to go to the ECS service and click on Task definition-> Create new task definition

Firstly we need to provide the name

need to copy and paste the Image URL from the 'Amazon ECR public gallery' site. Specify the port mappings for HTTP, by setting the "Container port" to 80.

We can find the Amazon ECR public gallery and search for nginx image and copy that image URL.

# ECR Public Gallery
https://gallery.ecr.aws/
# Official NGINX Docker Image ECR
https://gallery.ecr.aws/nginx/nginxhttps://gallery.ecr.aws/nginx/nginx

Now we need to click on next

Now we need to choose the fargate type and CPU and memory type .Here CPU is 1vCPU and the memory is 3GB.

We can use the CloudWatch service for monitoring and logging

Once we have reviewed all the details we can go ahead and create

After sometimes we can see that the task definition is successfully created.

Step 3:- Now we need to create a service

We need to click on cluster Ngnix-Cluster

We need to create service

We need to select the task and Service name

in networking need to select VPC and subnets

Create a new security group. Specify the port mappings for HTTP with port 80.

After review, we can click on If we go to cloud formation we can see the service is created successfully

Step 4:- Now we need to Test the Nginx container

Need to go to Clusters-> Tasks-> We need to click that service

After clicking on service need to go to the configuration tab and take the public ip and search in the browser so we can see the desired results

Devops#devops,#90daysofDevOps

Thank you for reading!! I hope you find this article helpful!!

if any queries or corrections to be done to this blog please let me know.

Happy Learning!!

Saikat Mukherjee

Printable, customizable thank you card templates | Canva

Did you find this article valuable?

Support Saikat Mukherjee's blog by becoming a sponsor. Any amount is appreciated!