Day48:Elastic Container Service(ECS)

90Days of DevOps Challenge

Day48:Elastic Container Service(ECS)

Container Management:

A container is a small, portable, executable package containing all the components needed to run an application, including the application itself and any necessary configurations, dependencies, system libraries, etc. The development and deployment of applications are significantly streamlined by containerization.

Containers can be deployed for applications on the AWS cloud platform. AWS has a special application for managing containerized applications. Elastic Container Service is AWS’s container orchestration tool which simplifies the management of containers. All the container management processes are collectively handled by the container orchestration tools eliminating the need for separate management of clusters.

What is ECS?

Amazon Elastic Container Service (ECS) is a fully managed container orchestration service provided by Amazon Web Services (AWS). It simplifies the deployment, management, and scaling of containerized applications using Docker containers. ECS allows you to run and manage containers without the need to install, operate, or scale the underlying infrastructure.

Key features of Amazon ECS include:

  1. Container Management: ECS handles the management and scaling of containers, allowing you to focus on running your applications. It integrates with other AWS services such as Elastic Load Balancing, Amazon VPC, AWS Identity and Access Management (IAM), and AWS CloudFormation.

  2. Compatibility with Docker: ECS is built with native support for Docker containers. You can package your applications and dependencies into Docker containers, and ECS takes care of scheduling, deploying, and scaling them across a cluster of EC2 instances or AWS Fargate.

  3. Task Definitions: You define your applications and their requirements using task definitions. Task definitions specify which Docker images to use, the resources required, networking and storage configurations, and other settings.

  4. Cluster Management: ECS enables you to create and manage clusters of EC2 instances or AWS Fargate tasks to run your containers. With clusters, you can scale your applications horizontally, manage resource allocation, and isolate workloads.

  5. Scheduling and Orchestration: ECS provides flexible scheduling options to control how containers are placed on instances or Fargate tasks. You can use either the built-in Amazon ECS scheduler or integrate with third-party schedulers like Kubernetes through the Amazon Elastic Kubernetes Service (EKS).

  6. Load Balancing and Auto Scaling: ECS integrates with Elastic Load Balancing to distribute traffic across multiple containers. It also supports auto scaling, allowing you to automatically adjust the number of containers based on resource utilization or custom-defined metrics.

  7. Integration with AWS Services: ECS seamlessly integrates with other AWS services. For example, you can use Amazon CloudWatch for monitoring, AWS Identity and Access Management (IAM) for access control, AWS Secrets Manager for securely storing sensitive information, and AWS App Mesh for advanced service mesh capabilities.

  8. AWS Fargate: ECS offers integration with AWS Fargate, a serverless compute engine for containers. With Fargate, you can run containers without managing the underlying infrastructure, freeing you from provisioning, scaling, and patching tasks.

What is Elastic Kubernetes Service (EKS)?

Elastic Kubernetes Service provides all of Kubernetes’ features and flexibility while leveraging the service’s managed nature. EKS deploys and manages containers using the Kubernetes concept of Pods, whereas ECS deploys them directly using individual containers. Pods contain one or more containers that share a resource pool and provide greater flexibility and fine-grained control over service components. Rolling updates, self-healing, auto-scaling, and scalability are all supported by EKS, which is built for high availability.

What is difference between EKS nd 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.

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.

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 own orchestration engine and does not support Kubernetes natively.

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.

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.

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.

Task :

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

Now, let's put theory into practice and walk through the steps to set up Nginx on ECS:

💨Step1: Sign in to the AWS Management Console at

📌Step2: Open the ECS Dashboard in the AWS Management Console. Create an ECS cluster.

  • Click on create Cluster button

🛠Step3: Create a name for your cluster and configure with the desired settings.

📑Step4: In the ECS service, click on "Task Definitions", and then click on "Create new Task Definition".

Next, create an ECS task definition. This definition specifies details like the Docker container to run, CPU and memory requirements, networking configurations, and more.

  • Set the container name to "nginx", copy and paste Image url from 'Amazon ECR public gallery' site. Specify the port mappings for HTTP , by setting the "Container port" to 80.

  • Configure any required container settings, such as CPU and memory limits.

  • Select "Fargate" as the launch type compatibility.

Browse Amazon ECR public gallery and search for nginx image and copy that image url.

  • Click on the 'Create' button

📚Step 5: Launch an ECS Service

With your task definition ready, create an ECS service. The service will ensure that your Nginx containers are up and running as per your specification

  • Click on Networking. configure the service settings, such as the VPC, subnet, and security group settings. Create a new security group

    • Click on the 'Create' button.

  • The Service is successfully created.

    Once the ECS service is running,

    📂Step6: Access your Nginx Application

    Test the Nginx container by accessing the public IP address of the Fargate task in a web browser. You can find the public IP address in the "Tasks" tab of the ECS service, under the "Configuration" section.

    ECS is a user-friendly, AWS-native service that simplifies container management, making it a great choice for those new to containerization. EKS, on the other hand, offers the full power of Kubernetes, making it ideal for organizations with existing Kubernetes expertise or those seeking advanced features.

    ✨✨I hope this article helps you gain a better understanding of these two robust options provided by AWS to cater to a wide range of containerization needs, ensuring that you can find the perfect fit for your projects on their cloud platform.☁☁

Thank you.....😊😊