Day48: AWS - Elastic Container Service

Day48: AWS - Elastic Container Service

This is#90DaysofDevopschallenge under the guidance ofShubham Londhesir.

Today, we delve into a pivotal topic: ECS, or Elastic Container Service. If you're unfamiliar, fear not – we're here to illuminate the path of container orchestration in the AWS ecosystem.

What is ECS?

  • ECS, short for Elastic Container Service, stands as a fully-managed container orchestration solution within Amazon Web Services (AWS). It empowers users to deploy and oversee Docker containers across a cluster of virtual machines (EC2 instances) sans the burdens of infrastructure management.

  • With ECS, managing containerized applications becomes a breeze. Through the AWS Management Console, CLI, or API, users can effortlessly deploy, scale, and oversee their containerized workloads. Moreover, ECS offers support for both "Fargate" and "EC2 launch types," granting flexibility in infrastructure deployment.

  • ECS seamlessly integrates with various AWS services, including Elastic Load Balancing, Auto Scaling, and Amazon VPC. This integration enables the construction of robust and scalable applications while simplifying the orchestration process. Notably, ECS extends support for Docker Compose and Kubernetes, easing the transition for users familiar with these frameworks.

  • In essence, ECS emerges as a potent ally, simplifying the deployment and management of containerized applications within the AWS environment.

Difference between EKS and ECS?

  • EKS (Elastic Kubernetes Service) and ECS (Elastic Container Service) serve as prominent container orchestration platforms within AWS. While both facilitate containerized application deployment, disparities exist between the two.

  • Architecture: ECS operates on a centralized architecture, managed by a control plane overseeing container scheduling on EC2 instances. In contrast, EKS employs a distributed architecture, dispersing the Kubernetes control plane across multiple EC2 instances.

  • Kubernetes Support: EKS serves as a fully managed Kubernetes service, enabling native Kubernetes support without the hassle of managing the control plane. On the contrary, ECS operates on its orchestration engine and does not natively support Kubernetes.

  • Scaling: EKS automates cluster scaling based on demand, whereas ECS necessitates manual configuration of scaling policies.

  • Flexibility: EKS offers greater flexibility, allowing customization and configuration of Kubernetes to suit specific needs. ECS, while simpler, provides fewer options for container orchestration.

  • Community: EKS benefits from a vibrant open-source community supporting Kubernetes, whereas ECS relies more heavily on AWS's guidance.

  • In conclusion, EKS is ideal for leveraging Kubernetes in managing containerized workloads, while ECS offers a streamlined approach for container deployment.

Task: Setting Up Nginx on ECS

To set up ECS (Elastic Container Service) and install Nginx on it, follow these steps:

  1. Go to the ECS service in your AWS console.

  2. Click on "Create Cluster."

  3. Configure your cluster by providing a name, selecting a Virtual Private Cloud (VPC), and choosing a subnet.

  4. Click 'Create' to finalize the cluster setup.

To confirm the cluster creation:

  1. Check if the cluster has been successfully created.

For creating a Task Definition:

  1. Go to the ECS service.

  2. Navigate to "Task Definitions."

  3. Select "Create new Task Definition."

  4. Container Name and Image URL:

    • Assign the container name as "nginx."

    • Get the Nginx image URL from the 'Amazon ECR public gallery' site.

  5. Port Mapping:

    • Set the "Container port" to 80 for HTTP.
  6. Amazon ECR Public Gallery:

    • Explore the Amazon ECR public gallery.

    • Find and copy the Nginx image URL.

  7. Task Configuration:

    • Click 'Next.'

    • Choose the Fargate launch type.

    • Configure task settings:

      • Set task memory limit to 1GB.

      • Set task CPU limit to 0.5vCPU.

  1. Click on 'Create.'

    1. Make sure the task is created successfully.

  • Set up a service: In ECS, go to "Clusters" and choose the cluster you made earlier.

  1. Click on "Create Service."

    Please select the task definition that was previously created.

  2. Sure, set up your service settings like VPC, subnet, and create a new security group. Also, define port mappings for HTTP with port 80.
    Click on 'Create' to make the service.

  3. Check that the service was made successfully.

    After your ECS service starts:

    1. Go to your ECS cluster.

    2. Click on 'Task.'

    3. Look for the public IP address in the task details under 'Configuration.'

  4. To check if Nginx is working:

    1. Open your web browser.

    2. Type in the public IP address.

    3. You should see the default Nginx welcome page.

💡
Feel free to ask any questions 🤔 or let me know if you need assistance! I would be happy to answer them!
💡
If you found this helpful, a thumbs up👍 and a follow would mean a lot! Your support is truly appreciated.

Thank you for taking the time to read! 💚

Did you find this article valuable?

Support Akash Dhengale by becoming a sponsor. Any amount is appreciated!