DEV Community

Aravind kumar TS
Aravind kumar TS

Posted on

Glimpse of ECS,EKS, Fargate ( Serverless)

Image description

Two containers in AWS == ECS, EKS, EKS aka K8s — — 8 stands for ubernet

EKS is complex rich

In ECS tasks are containers that runs on underlying compute but the tasks are isolated

In EKS collection of containers are called Pods

ECS can be launched in two ways

1.EC2

2.Fargate

using EC2 we are responsible for patching and manual scale in and scale out

Fargate is fully automated

In ECS you can allocate CPU and memory for your containers

ECS integrates with VPC, Security groups, EBS, Load balancers

ECS can be integrated with Cloudtrail and Cloudwatch

ECS supports ALB, NLB

ECS + ELB — Distributes traffic evenly across tasks in your service

ALB routes HTTP/HTTPS traffic (Layer 7)

NLB routes TCP traffic (Layer4)

ECS components -

Image description

1.Cluster — Logical collection of ECS resources it can be EC2 instances or Fargate instances

  1. Task Definition — Defines your application, similar to dockerfile, It can contain multiple containers, two containers needs to run together you can place them in same task definition.

  2. Container definition — It defines the container’s CPU, Memory and port mappings

  3. Task — This is a single working copy of a container, it can be web container or DB

  4. Service — Allows task definition to be scaled by adding tasks, defines minimum and maximum value

  5. Registry — Storage for container images ex Elastic container registry or Docker hub helps to used to download images to create containers

Fargate — Serverless, container engine

When you launch ECS using Fargate you get the below

Image description

It works with both ECS and EKS

ECS security has EC2 instance role when its applied it gets applied to the all tasks that runs inside the EC2

Task role — this can be defined and limited to the particular task in order to access other resources such as S3, Dynamo DB, etc

When you Launch a ECS in console, the following things gets created

Image description

If you initiate ECS you get this

  1. As a first step choose the image for your ECS, choose a name for this cluster

  2. It automatically creates VPC and two subnets

  3. IT creates a Cloudwtach log group

  4. IT creates a cloudformation stack

  5. The task has both Public and Private IP

When you launch a EC2 to use ECS choose Amazon AMI with ECS this can be found under community AMI

Choose IAM role as Ecsinstancerole

Now the ECS agent needs to communicate with our ECS cluster,

Under advanced details type -

/bin/bash

echo ECS_CLUSTER=give your cluster name here >> /etc/ecs/ecs.config

(Since medium blog is not free, I have replicated my medium blog here)

Top comments (0)