DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

GitHub Docker AWS EC2 AWS ALB Application

The idea is to show them an entire deployment pipeline exactly like a real company, just simplified.


Production Story

"You joined ABC Bank as a Junior DevOps Engineer.

The developers created a website.

Your responsibility is NOT to write code.

Your responsibility is to deploy it into production."

Production Flow

Developer
     │
     ▼
GitHub Repository
     │
     ▼
Clone Repository
     │
     ▼
Docker Image
     │
     ▼
Docker Container
     │
     ▼
AWS EC2
     │
     ▼
Application Running
     │
     ▼
Application Load Balancer
     │
     ▼
Users
Enter fullscreen mode Exit fullscreen mode

Company Architecture

                    Internet
                        │
                        ▼
               Application Load Balancer
                        │
        ┌───────────────┴───────────────┐
        │                               │
        ▼                               ▼
     EC2 Server 1                  EC2 Server 2
   Docker Container             Docker Container
        │                               │
        └───────────────┬───────────────┘
                        │
                    GitHub Code
Enter fullscreen mode Exit fullscreen mode

Explain:

Developer pushes code.

DevOps pulls code.

DevOps builds Docker image.

Docker runs application.

ALB distributes traffic.

Exactly what happens in production.


Lab Objective

Students will

✅ Create GitHub repository

✅ Push application

✅ Launch EC2

✅ Install Docker

✅ Clone GitHub

✅ Build Docker image

✅ Run container

✅ Access application

✅ Create Load Balancer


Part 1 — Create GitHub Repository

Why?

Production companies never deploy files manually.

Everything is stored in GitHub.

Students create repository

bank-website
Enter fullscreen mode Exit fullscreen mode

Upload

index.html

Dockerfile
Enter fullscreen mode Exit fullscreen mode

Repository

bank-website

│
├── Dockerfile

├── index.html

└── README.md
Enter fullscreen mode Exit fullscreen mode

Explain

Developer writes code.

Git stores versions.

GitHub stores project online.

DevOps downloads latest version.


Part 2 — Create Dockerfile

Explain

Docker packages application with everything needed.

Dockerfile

FROM nginx

COPY . /usr/share/nginx/html
Enter fullscreen mode Exit fullscreen mode

Explain each line.

FROM nginx

Use official nginx image.

COPY

Copy website into nginx folder.


Build Docker Image

Command

docker build -t bank-app .
Enter fullscreen mode Exit fullscreen mode

Explain

Docker reads Dockerfile

Creates Image

Image is template

Container runs from image

Diagram

Dockerfile

      │

docker build

      │

      ▼

Docker Image

      │

docker run

      ▼

Container
Enter fullscreen mode Exit fullscreen mode

Verify

docker images
Enter fullscreen mode Exit fullscreen mode

Students see

bank-app
Enter fullscreen mode Exit fullscreen mode

Run Container

docker run -d -p 80:80 bank-app
Enter fullscreen mode Exit fullscreen mode

Explain

-d

Run in background.

-p

Map port.

80:80

Computer Port

Container Port

Diagram

Browser

↓

EC2 Port 80

↓

Docker Port 80

↓

Website
Enter fullscreen mode Exit fullscreen mode

Verify

docker ps
Enter fullscreen mode Exit fullscreen mode

Explain

Production engineers constantly check running containers.


Stop

docker stop containerID
Enter fullscreen mode Exit fullscreen mode

Remove

docker rm containerID
Enter fullscreen mode Exit fullscreen mode

Part 3 — AWS EC2

Create Ubuntu instance.

Explain

EC2 is just a virtual Linux server.

Instead of

Dell Computer
Enter fullscreen mode Exit fullscreen mode

Company rents

AWS EC2
Enter fullscreen mode Exit fullscreen mode

Security Group

Open

22 SSH

80 HTTP
Enter fullscreen mode Exit fullscreen mode

Explain

SSH

Developers log in.

HTTP

Customers access website.


Connect

ssh ubuntu@IP
Enter fullscreen mode Exit fullscreen mode

Explain

Now you are inside production server.


Update Server

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Why?

Install latest package information.


Install Docker

sudo apt install docker.io -y
Enter fullscreen mode Exit fullscreen mode

Start

sudo systemctl start docker
Enter fullscreen mode Exit fullscreen mode

Enable

sudo systemctl enable docker
Enter fullscreen mode Exit fullscreen mode

Check

docker --version
Enter fullscreen mode Exit fullscreen mode

Clone Repository

git clone https://github.com/student/bank-website.git
Enter fullscreen mode Exit fullscreen mode

Explain

Production servers pull code from GitHub.

Not email.

Not USB.

GitHub.


Move

cd bank-website
Enter fullscreen mode Exit fullscreen mode

Build Docker

docker build -t bank-app .
Enter fullscreen mode Exit fullscreen mode

Run

docker run -d -p 80:80 bank-app
Enter fullscreen mode Exit fullscreen mode

Test

Browser

http://EC2-IP
Enter fullscreen mode Exit fullscreen mode

Website appears.


Production Explanation

Developer

Git Push

GitHub

DevOps SSH

Git Pull

Docker Build

Docker Run

Website


Part 4 — Application Load Balancer

Now explain production.

One server is dangerous.

If EC2 crashes

Website dies.

Need

ALB
Enter fullscreen mode Exit fullscreen mode

Architecture

                Users

                   │

                   ▼

        Application Load Balancer

             │             │

             ▼             ▼

      EC2 Server      EC2 Server

             │             │

      Docker App      Docker App
Enter fullscreen mode Exit fullscreen mode

Create

Target Group

Add EC2

Create ALB

Listener

HTTP 80

Choose Target Group

Finish


Copy DNS

http://xxxxx.us-east-1.elb.amazonaws.com
Enter fullscreen mode Exit fullscreen mode

Students access website.


Explain

Instead of users visiting EC2

54.xx.xx.xx
Enter fullscreen mode Exit fullscreen mode

Users visit

company.com
Enter fullscreen mode Exit fullscreen mode

ALB decides

Which server receives request.


Production Request Flow

Browser

↓

DNS

↓

Application Load Balancer

↓

Target Group

↓

Healthy EC2

↓

Docker Container

↓

Nginx

↓

Website
Enter fullscreen mode Exit fullscreen mode

Show Failure Scenario

Stop Docker

docker stop containerID
Enter fullscreen mode Exit fullscreen mode

Refresh

Website down.

Explain

In production

ALB health check detects failure.

Traffic automatically moves to healthy server.

Students understand why companies use multiple EC2 instances.


Explain Every Technology Like a DevOps Engineer

GitHub

Stores source code.

Single source of truth.

Version control.

Collaboration.


Docker

Packages application.

Runs same everywhere.

Developer laptop.

Testing.

Production.

Cloud.


EC2

Virtual Linux server.

Runs Docker containers.

Hosted in AWS.


ALB

Traffic manager.

Receives all user requests.

Routes traffic.

Performs health checks.

Improves availability.


Nginx

Web server.

Serves HTML.

Receives HTTP requests.

Returns web pages.


Real Production Workflow

Developer
     │
git commit
     │
git push
     ▼
GitHub Repository
     │
DevOps Engineer
     │
git pull
     ▼
Docker Build
     │
Docker Image
     │
Docker Container
     ▼
AWS EC2
     │
Health Check
     ▼
Application Load Balancer
     │
Internet
     ▼
Users
Enter fullscreen mode Exit fullscreen mode

What students learn by the end

By completing this lab, beginners can confidently explain a common DevOps deployment workflow:

  • How developers use Git and GitHub to manage application code.
  • How Docker packages an application into a portable image.
  • How a Docker container runs the application on an AWS EC2 instance.
  • Why security groups must allow SSH (22) for administrators and HTTP (80) for users.
  • How an Application Load Balancer distributes incoming traffic and performs health checks.
  • Why production environments use multiple EC2 instances behind an ALB for high availability.
  • The complete request flow from a user's browser to the application running inside a Docker container.

This mirrors a simplified version of the deployment process used by many organizations and gives students a strong foundation before introducing CI/CD pipelines, container registries (ECR), ECS/EKS, Terraform, and Kubernetes.

Top comments (0)