DevOps Classroom notes 27/Sep/2026

Aws ECS

  • ecs elastic container service is fully managed by aws and used for container orchestration service which will help run, stopm and scale Docker container

core componets:

  1. cluster: A logical grouping of tasks or services
  2. Task defination: A json/configuration of your container or blue print of container
  3. service: Automatically manage containers like upgrade, rollback, loadblancer and replicas

lanch Types in ECS

  • aws fargate: serverless compute which will managed by aws
  • Amazon EC2-instance type: managed ec2 instance

create ec2 instance and install docker and awscli

curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
rm get-docker.sh
sudo apt install unzip -y 

curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash
curl -fsSL https://awscli.amazonaws.com/v2/install.sh | sudo bash -s -- --system
curl -fsSL https://awscli.amazonaws.com/v2/install.sh | bash -s -- --help
aws update

aws configure

AWS Access Key ID [None]: AKIAXHXSL4MX********
AWS Secret Access Key [None]: 2opqbBilS3UvCKkSpc*************
Default region name [None]: us-east-1
Default output format [None]: json

pull image and push public ECR

docker pull httpd:latest

aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/i7p5t6j4

docker images

docker tag httpd:latest public.ecr.aws/i7p5t6j4/dev/apache2:latest

docker push public.ecr.aws/i7p5t6j4/dev/apache2:latest

steps to deploy httpd in ecs

  1. create cluster and select type fargate
  2. create task defination
{
    "family": "apache2",
    "containerDefinitions": [
        {
            "name": "httpd",
            "image": "497650754350.dkr.ecr.us-east-1.amazonaws.com/dev/apache2@sha256:3a1e0bbe28c4673a03b7a3fbc71a56325eacb1a8d11c1ad696fbf9678f07febd",
            "cpu": 2048,
            "memory": 3072,
            "memoryReservation": 1024,
            "portMappings": [
                {
                    "containerPort": 80,
                    "hostPort": 80,
                    "protocol": "tcp",
                    "name": "httpd-80-tcp",
                    "appProtocol": "http"
                }
            ],
            "essential": true,
            "restartPolicy": {
                "enabled": true
            },
            "environment": [
                {
                    "name": "container_type",
                    "value": "fargate"
                },
                {
                    "name": "enviroment",
                    "value": "dev"
                },
                {
                    "name": "project",
                    "value": "demo"
                }
            ],
            "environmentFiles": [],
            "mountPoints": [],
            "volumesFrom": [],
            "ulimits": [],
            "logConfiguration": {
                "logDriver": "awslogs",
                "options": {
                    "awslogs-group": "/ecs/apache2",
                    "awslogs-create-group": "true",
                    "awslogs-region": "us-east-1",
                    "awslogs-stream-prefix": "ecs"
                },
                "secretOptions": []
            },
            "systemControls": []
        }
    ],
    "executionRoleArn": "arn:aws:iam::497650754350:role/ecsTaskExecutionRole",
    "networkMode": "awsvpc",
    "volumes": [],
    "placementConstraints": [],
    "requiresCompatibilities": [
        "FARGATE"
    ],
    "cpu": "2048",
    "memory": "4096",
    "ephemeralStorage": {
        "sizeInGiB": 21
    },
    "runtimePlatform": {
        "cpuArchitecture": "X86_64",
        "operatingSystemFamily": "LINUX"
    },
    "enableFaultInjection": false
}
  1. create service with application loadbalancer
  2. open http, https port for loadbalancer secuirty group
  3. test ALB endpoint and access ecs apache2 container

Task

  1. create own image and push image ECR and deploy in ECS follow class recording.
  2. try both service and express service and run task.
  3. try to do it in terraform

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube