Day 48 of #90daysofdevops
Hey Techies! Welcome to this blog
In this blog, we are going to start with ECS (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.
Task :
Set up ECS (Elastic Container Service) by setting up Nginx on ECS.
Step: 1 Create an ECS Cluster
Set up ECS (Elastic Container Service) by setting up Nginx on ECS.
- Go to your AWS account and search ECS, click on ECS, Click on Create Cluster
- Give the name of your cluster, Let the Networking be default & by default Infrastructure AWS Fargate (Serverless) is selected.
- Cluster is successfully created
Step: 2 Create a task definition
- In the left Panel of ECS Select Task Definitions
- Click on Create new task definitions & Create new task definition
- Enter details like Task definition family name, container name.
- Enter other configuration details like Task size & Task roles as ecsTaskExecutionRole
For entering “Image URL”, open a new tab in your internet browser. Enter web url as “gallery.ecr.aws”.
Search for Nginx image by typing Nginx in search box
Copy the NGINX image URL
- Go back to your Task definitions and past the copied URL in Image URL
- Enable the Log collection & Click on Create
- Task Definition created successfully
Step: 3 Create a Service
In the ECS console, click on Clusters, then click on the cluster you created
Go to Deploy--> Run Task
- Select the cluster where you want to deploy & click on create
Service created created successfully
Step: 4 Access Nginx on ECS
Click on Task go to configuration section, Click on ENI ID
on the page click on Security groups & add port 80 in inbound rule
As well create service
Click on Create which is next to Services.
Let the Environment section be the default.
In the Deployment Configuration section > Select Service > Give the Service Name > Select the task definition you created.
In the Networking Tab > Let the things be default except for SG > Click on Create new SG.
Security group name: nginx-SG
Security group description: Security Group for Nginx Cluster
Let’s test by accessing the Nginx container using the Public IPv4 of Fargate.\
Congratulations! we have set up ECS with Nginx.
That's it! You've just completed the task. 🎉
Thank you so much for taking the time to read till the end! Hope you found this blog informative and helpful.
Feel free to explore more of my content, and don't hesitate to reach out if need any assistance from me or in case of you have any questions.
Happy Learning!
~kritika :)
Connect with me: LinkedIn