Day-48 - Elastic Container Service ????

Day-48 - Elastic Container Service ????

What is ECS?

  • ECS (Elastic Container Service) 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.

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.

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.

1. Create an ECS cluster:

Click on "Create Cluster" under the ECS service.

No alt text provided for this image

Set up the cluster's settings, including its name, VPC, and subnet.

No alt text provided for this image

Click on 'Create'

No alt text provided for this image

Cluster formation is successful.

No alt text provided for this image

2. Create a task definition:

Click "Task Definitions" in the ECS service, followed by "Create new Task Definition."

No alt text provided for this image

Insert the image URL from the "Amazon ECR public gallery" website after setting the container name to "nginx." Specify the port mappings for HTTP, by setting the "Container port" to 80.

No alt text provided for this image

Find an nginx image in the Amazon ECR public gallery and copy the image's URL.

No alt text provided for this image

Click on 'Next'

No alt text provided for this image

Select the Fargate launch type, then set the task parameters, including the task memory and CPU limits (in this case, CPU). 5vCPU and 1GB of memory.

No alt text provided for this image
No alt text provided for this image

Click on 'Create'

No alt text provided for this image

The task was successfully created.

No alt text provided for this image

3. Create a service:

Select the cluster that you created in the ECS by clicking on "Clusters."

No alt text provided for this image

Click on "Create Service"

No alt text provided for this image

Select the task definition you created in the aforementioned steps.

No alt text provided for this image
No alt text provided for this image

configure the service settings, such as the VPC, subnet, and security group settings. Establish a new security group

No alt text provided for this image

Configure HTTP port mappings with port 80.

No alt text provided for this image

Click on 'Create'.

The service was successfully created.

No alt text provided for this image

Once the ECS service is running, test the Nginx container by accessing the public IP address of the Fargate task in a web browser. The public IP address can be found in the ECS service's "Tasks" tab, under the "Configuration" section.

4. Test the Nginx container:

Click on the "cluster" that you created.

No alt text provided for this image

Click on 'Task'.

No alt text provided for this image

In the task, go to the 'configuration' section, there you can find public IP.

No alt text provided for this image

If you browse the public IP address, you can see the default Nginx welcome page.

No alt text provided for this image

Thank you for sticking with me; I hope you learned something. ?? ??

Sunil Kumar

Senior Cloud Engineer - Nagarro | Google Cloud Certified {"CDI, ACE , PCA, PDE}|Cloud DevOps Specialist | 5x GCP , Azure Certified | Devops | Linux | Docker | Terraform | Jenkins CI/CD | Kubernetes

1 年

well explained blog Vinay Kumar keep this up bro !!

要查看或添加评论,请登录

社区洞察

其他会员也浏览了