AWS ECS : Scalable and Cost effective Architecture

September 1, 2023
AWS ECS

“ECS is an AWS Docker Elastic Container Service for orchestrating and provisioning Docker containers. This blog helps set up ECS on AWS”

ECS is an AWS service to executes Docker as containers. An orchestration that makes it possible to start isolated container instances is called Docker. Docker containers may be set up and monitored on an ECS cluster using ECS, which runs on top of Docker.

Why ECS

Scalability and Cost Effectiveness

ECS supports auto-scaling, allowing you to handle variable volume by increasing or decreasing the number of containers based on metrics like traffic, memory utilization, or CPU utilization. ECS is suitable for ad hoc jobs or full-scale services. Using ECS with Docker is cost-effective, as multiple containers can be hosted on a single compute resource, optimizing resource utilization.

Comparison with Lambda and EC2

ECS is one level up if we discuss about Lambda and EC2. With Lambda, you only worry about code, as it is a serverless option. With EC2, you have to deploy your code to EC2 machines and manage infrastructure. ECS combines containerization advantages with simplified infrastructure management. ECS is highly configurable. You can set your architecture from the most cost-effective to very very high latency managed robust architecture.

Security and Compliance

ECS offers security features like IAM roles, resource-level permissions, encryption, and integration with AWS IAM. It supports compliance standards like HIPAA, PCI DSS, and GDPR, enabling applications to meet regulatory requirements.

Terminology of ECS

Lets understand the ECS terminology which will help set up ECS containers

When We started exploring EC2 and were introduced to all the terms, We were wondering what was going on. But later these terminologies helped us manage our application with ECS well.

  • Task Definition A docker container should launch according to the instructions in the given Dockerfile code. It is similar to a Launch Configuration, It is one kind of blueprint to execute a container. It has parameters for exposed ports, Docker images, CPU shares, memory requirements, command-to-launch commands, and environmental variables.
  • Task The operating container is known as Task. It has the settings specified in the Task Definition. You may consider it a “small running instance” of a task definition.
  • Service Long-running tasks of the same Task Definition are defined by the Service. This might be one active container or several active containers working together under the same Task Definition.
  • Cluster An EC2 instance cluster. The server’s ecs-agent software registers each newly launched instance with an ECS Cluster. Setting the ECS_CLUSTER variable in /etc/ecs/ecs.config, as discussed here, makes this simple to customize.
  • Container Instance This is a simple ECS Cluster-connected EC2 instance that is running Docker and the ECS agent.
  • AWS Elastic Container Registry (ECR) Amazon ECR (Elastic Container Registry) is a repository for container images, providing an alternative to Docker Hub or Nexus Docker Repository. It integrate seamlessly with other AWS services and enables you to store your Docker images.

Basic Architecture Diagram

To help you understand the terminology and visualise them, below is a simplified graphic AWS diagram.

How to set AWS ECS up?

Before moving forward with AWS ECS the main thing we need to set up is to set up and docker container which runs smooth on the local machine first. And push the container image to Elastic Container Repository. If ECR is stable, flexible to connect with your database, and free from environment variables, It will make ECS architecture like far easy to adapt.

Lets understand the whole artitecture with the help of diagram. Here we have many Topics to cover like,

Create VPC with Public and Private Subnets for Your Clusters Separate RDS with all the configuration and use common security group to access the private database ( Do not access to public , only by security group and private subnates)

  • Create a cluster with a EC2 / Farget selection
  • Setup Application load balancer with forwarding rules and SSL certification
  • Setup Target ground which will manage instance targets and health indication to manage autoscalling
  • Add secutiry groups which will restrict the IP ports inbound and outbound
  • Setup Task Defination which will manage different containers configurations
  • Setup Cluster and its auto scalling to up scale and downscale memory and CPU management
  • Setup Services on cluster which will manage all task definition and configure a glue between EC2 / Farget , Loadbalancer , and Autoscalling
  • Execute all the task and test applications with application load balancer Cname
  • Once all done configure route 53 with Load balancer

Conclusion

With the helo of above topics , we will learn the full concept of AWS ECS, This is a once time setup which will make developers life easy and smooth. Develoepes will focus on programing application and not worried of architecure untill there is any major change. Lets see more in next topics.

As we have just started understanding about AWS ECS with diagrams and terminology, in upcoming blogs we will unleash more with each topics I have mentioned under “How its all sets up ECS. For the upcoming blogs, make sure you understand the terminology for more clerity.

All product and company names are trademarks™, registered® or copyright© trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Related Blog

Cloud Computing Trends
Top 10 Cloud Computing Trends to Watch

Cloud computing has been here since the 1950s when mainframe computers were invented. Since the last decade, it has seen Read more

Ways-Cloud-Computing
8 Ways Cloud Computing Can Boost Small Business

The most viable and effective ways to use cloud computing services in your small enterprise and make business run faster, Read more

7 Cloud Computing Threats Enterprises are Reeling Under
7 Cloud Computing Threats Enterprises are Reeling Under

There are many multi-billionaire companies like Amazon, Microsoft, and Google that are using cloud computing. Here 7 Cloud Computing Threats Read more

Stay in the know with our newsletter
  • Stay in the know with our newsletter

    Subscribe our newsletter and get the latest update or news in your inbox each week