A web application to manage employees — built with Docker and deployed on AWS EKS.
-
Go to EC2 → Launch Instance
-
Choose:
- AMI:
Amazon Linux 2023 - Instance type:
t3.medium(2 vCPU, 4 GB RAM) - Storage:
20 GB gp3
- AMI:
-
Create or select a key pair (
.pemfile) -
Configure Security Group — open these ports:
Port Purpose 22 SSH 80 HTTP 5000 Backend API 8080 Frontend -
Launch and SSH in:
chmod 400 your-key.pem
ssh -i your-key.pem ec2-user@<EC2_PUBLIC_IP>sudo dnf update -y
sudo dnf install -y docker git
sudo systemctl enable --now docker
sudo usermod -aG docker ec2-user
newgrp dockerVerify:
docker --versiongit clone https://github.com/LandmakTechnology/employee-app.git
cd employee-appdocker build -t employee-backend:v1 ./backend
docker build -t employee-frontend:v1 ./frontendVerify:
docker images- Log in to DockerHub:
docker login
# enter your DockerHub username and password/token- Tag the images (replace
<your-dockerhub-username>):
docker tag employee-backend:v1 <your-dockerhub-username>/employee-backend:v1
docker tag employee-frontend:v1 <your-dockerhub-username>/employee-frontend:v1- Push:
docker push <your-dockerhub-username>/employee-backend:v1
docker push <your-dockerhub-username>/employee-frontend:v1macOS (Homebrew):
brew tap hashicorp/tap
brew install hashicorp/tap/terraformLinux:
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update && sudo apt-get install terraformVerify:
terraform -version- Go to IAM → Users → Create user
- Username:
terraform-user - Select Attach policies directly and attach:
AmazonEKSClusterPolicyAmazonEKSWorkerNodePolicyAmazonEC2FullAccessIAMFullAccessAmazonVPCFullAccessAmazonEKSFullAccess(orAdministratorAccessfor a lab environment)
- Go to the user → Security credentials → Create access key
- Choose CLI use case and save the
Access Key IDandSecret Access Key
macOS:
brew install awscliLinux:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/installaws configure --profile terraformEnter when prompted:
AWS Access Key ID: <your-access-key-id>
AWS Secret Access Key: <your-secret-access-key>
Default region name: us-east-1
Default output format: json
Verify:
aws sts get-caller-identity --profile terraformcd employee-app/terraformInitialize Terraform:
terraform initPreview the infrastructure:
terraform plan -var-file=env/dev/terraform.tfvarsApply (this creates the VPC, EKS cluster, and node group — takes ~15 min):
terraform apply -var-file=env/dev/terraform.tfvarsType yes when prompted.
Install kubectl if not already installed:
# macOS
brew install kubectl
# Linux
curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && sudo mv kubectl /usr/local/bin/Update your kubeconfig:
aws eks update-kubeconfig --name landmark-cluster-dev --region us-east-1 --profile terraformVerify the connection:
kubectl get nodeskubectl create namespace employee-appkubectl run backend-pod \
--image=<your-dockerhub-username>/employee-backend:v1 \
--port=5000 \
--namespace=employee-appCheck it:
kubectl get pods -n employee-app
kubectl logs backend-pod -n employee-app# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
namespace: employee-app
spec:
replicas: 2
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
spec:
containers:
- name: backend
image: <your-dockerhub-username>/employee-backend:v1
ports:
- containerPort: 5000Apply:
kubectl apply -f deployment.yaml
kubectl rollout status deployment/backend -n employee-app# service.yaml
apiVersion: v1
kind: Service
metadata:
name: backend-nodeport
namespace: employee-app
spec:
type: NodePort
selector:
app: backend
ports:
- port: 5000
targetPort: 5000
nodePort: 30500Apply:
kubectl apply -f service.yaml
kubectl get svc -n employee-app- Get the public IP of any worker node:
kubectl get nodes -o wide
# copy the EXTERNAL-IP of any node-
Make sure port
30500is open in the EC2 Security Group of the worker nodes. -
Open in your browser or curl:
curl http://<NODE_EXTERNAL_IP>:30500/api/health| Method | Path | Description |
|---|---|---|
GET |
/api/employees |
List all employees |
POST |
/api/employees |
Create employee |
PUT |
/api/employees/<id> |
Update employee |
DELETE |
/api/employees/<id> |
Delete employee |
GET |
/api/health |
Health check |