About My Deployment Flow

CI/CD pipeline using GitHub Actions, Docker, ECR, ECS Fargate & Load Balancer

Overview

This project uses a fully automated CI/CD deployment pipeline. Every push to main builds a Docker image, pushes it to ECR, updates ECS task definitions, and redeploys the service behind an Application Load Balancer.

Deployment Flow

GitHub

1. GitHub Actions

Push triggers workflow → builds Docker image → deploys to AWS.

Docker

2. Docker Image Build

GitHub builds the Docker image using your Dockerfile.

ECR

3. Amazon ECR

The Docker image is pushed to Amazon Elastic Container Registry.

Task

4. ECS Task Definition

Task definition updates automatically with the new image.

ECS

5. ECS Fargate

Fargate deploys the updated container serverlessly.

Load Balancer

6. Load Balancer

ALB routes traffic and keeps the app always available.

GitHub Actions Workflow


name: Deploy to Amazon ECS

on:
  push:
    branches: [ "main" ]

env:
  AWS_REGION: ap-south-1
  ECR_REPOSITORY: node/mk-pipeline
  ECS_SERVICE: mk-task-definition-service-8pqtz7f5
  ECS_CLUSTER: mk-cluster
  ECS_TASK_DEFINITION: .aws/task-definition.json
  CONTAINER_NAME: mk-container

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ env.AWS_REGION }}

      - uses: aws-actions/amazon-ecr-login@v1

      - name: Build Docker Image
        run: |
          docker build -t ... (trimmed)