Some text some message..
Back 🌈 GitHub Actions → AWS Deployment Flow 23 Aug, 2025

🔹 Step 1: Push Code to GitHub

  • What happens?
    A developer commits code changes and pushes them to a branch (e.g., main or dev) on GitHub.

  • Trigger: This push acts as a trigger for GitHub Actions.

  • Example:

    git add .
    git commit -m "Added new API endpoint"
    git push origin main
    

🔹 Step 2: GitHub Action Workflow Starts

  • What happens?
    GitHub Actions sees the push and starts a workflow (defined in .github/workflows/deploy.yml).

  • Inside deploy.yml example:

    name: Deploy to AWS
    
    on:
      push:
        branches:
          - main
    
    jobs:
      build-and-deploy:
        runs-on: ubuntu-latest
        steps:
          - name: Checkout Code
            uses: actions/checkout@v3
    
  • Colorful Idea: Think of this as a pipeline button that gets pressed automatically after every push.


🔹 Step 3: Build / Test Phase

  • What happens?
    GitHub Action runner checks your code, installs dependencies, runs tests, and builds the project.

  • Example: (For Node.js app)

    - name: Install Dependencies
      run: npm install
      
    - name: Run Tests
      run: npm test
      
    - name: Build Project
      run: npm run build
    
  • ✅ This ensures only tested and built code goes for deployment.


🔹 Step 4: Authenticate with AWS

  • What happens?
    GitHub Action needs permission to talk to AWS. This is done via AWS Access Key & Secret Key stored in GitHub Secrets.

  • Example:

    - name: Configure AWS Credentials
      uses: aws-actions/configure-aws-credentials@v4
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: ap-south-1
    
  • Colorful Analogy: This is like giving GitHub a VIP Pass to enter AWS.


🔹 Step 5: Deploy to AWS Service

Here’s where the magic happens 💫
Depending on your app, you may deploy to:

  • EC2 (Virtual Machine)

  • ECS/Fargate (Containers)

  • Lambda (Serverless Functions)

  • S3 + CloudFront (Static Websites)

  • EKS (Kubernetes)


🟢 Example 1: Deploy to AWS S3 (Static Website)

- name: Deploy to S3
  run: aws s3 sync ./build s3://my-app-bucket --delete

👉 Uploads build files to S3 bucket for hosting.


🔵 Example 2: Deploy to ECS (Container App)

- name: Build Docker Image
  run: docker build -t my-app:latest .

- name: Push to ECR
  run: |
    aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin <account_id>.dkr.ecr.ap-south-1.amazonaws.com
    docker tag my-app:latest <account_id>.dkr.ecr.ap-south-1.amazonaws.com/my-app:latest
    docker push <account_id>.dkr.ecr.ap-south-1.amazonaws.com/my-app:latest

- name: Update ECS Service
  run: |
    aws ecs update-service --cluster my-cluster --service my-service --force-new-deployment

👉 This builds a Docker image, pushes it to ECR, and tells ECS to deploy the new version.


🔴 Example 3: Deploy to AWS Lambda

- name: Zip & Deploy to Lambda
  run: |
    zip -r function.zip .
    aws lambda update-function-code --function-name my-lambda-fn --zip-file fileb://function.zip

👉 This uploads your code package to Lambda.


🔹 Step 6: Post Deployment Verification

  • Run smoke tests or health checks to confirm the deployment worked.

  • Example:

    - name: Verify Deployment
      run: curl -I https://myapp.com
    

✅ Ensures users get the updated version.


🔹 Step 7: Notifications (Optional)

  • GitHub can notify via Slack, Teams, or Email when deployment succeeds/fails.

  • Example:

    - name: Notify on Slack
      uses: slackapi/slack-github-action@v1.23
      with:
        payload: '{"text":"🚀 Deployment successful!"}'
    

🌟 Visual Flow (Colorful Concept)

👨‍💻 Developer Push Code
       ⬇
⚡ GitHub Action Trigger
       ⬇
🛠️ Build & Test
       ⬇
🔐 Authenticate with AWS
       ⬇
🚀 Deploy to AWS (EC2 / ECS / Lambda / S3)
       ⬇
✅ Verify & Notify

👉 This is the end-to-end journey from GitHub to AWS Deployment.