A production-grade REST API deployed on AWS EKS with full CI/CD and monitoring.
Explore the repo »
Report Bug
·
Request Feature
Table of Contents
A fully containerized Notes REST API built with Node.js and PostgreSQL, deployed to a Kubernetes cluster on AWS EKS. The project demonstrates end-to-end cloud engineering, from infrastructure provisioning with Terraform to automated deployments via GitHub Actions and real-time monitoring with Prometheus and Grafana.
Key highlights:
- Infrastructure provisioned entirely with Terraform(VPC, EKS cluster, IAM roles, and Kubernetes resources)
- Automated CI/CD pipeline that builds, tags, and deploys on every push to main
- Prometheus and Grafana monitoring deployed to the cluster via Helm
- Containerized with Docker and orchestrated with Kubernetes
-
Clone the repo
git clone https://github.com/KRC00112/notesAPI.git cd notesAPI -
Start the app and database
docker compose up --build
-
API is available at
http://localhost:5000
-
Provision infrastructure
cd terraform terraform init terraform apply -
Update your kubeconfig
aws eks update-kubeconfig --region us-west-2 --name <cluster-name>
-
Verify the cluster is accessible
kubectl get nodes
-
Create the notes table
kubectl exec -it deployment/postgres-deployment -- /bin/shpsql -U postgres
\c notesdbCREATE TABLE notes (note_id SERIAL PRIMARY KEY, created_at TIMESTAMP DEFAULT NOW(), note VARCHAR(255) NOT NULL);
-
Install Prometheus and Grafana monitoring
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update helm install prometheus prometheus-community/kube-prometheus-stack \ --namespace monitoring --create-namespace
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Get all notes |
| GET | /:id |
Get a note by ID |
| POST | / |
Create a new note |
| PUT | /:id |
Update a note |
| DELETE | /:id |
Delete a note |
Example - create a note:
curl -X POST http://<load-balancer-url>:5000/ -H "Content-Type: application/json" -d '{"note": "my first note"}'Example - get all notes:
curl http://<load-balancer-url>:5000/Two GitHub Actions workflows handle automated deployment:
CI (ci.yaml) - triggers on every push to main:
- Log in to Docker Hub
- Build the image via Docker Compose
- Tag with the commit SHA and push to Docker Hub
CD (cd.yaml) - triggers when CI completes successfully:
- Configure AWS credentials
- Update kubeconfig for the EKS cluster
- Deploy the new image with
kubectl set imageusing the exact commit SHA - Wait for rollout to complete
Using commit SHA tags instead of latest ensures Kubernetes always pulls the exact image that was just built, avoiding caching issues.
| Secret | Description |
|---|---|
DOCKERHUB_USERNAME |
Docker Hub username |
DOCKERHUB_TOKEN |
Docker Hub access token |
AWS_ACCESS_KEY_ID |
AWS IAM access key ID |
AWS_SECRET_ACCESS_KEY |
AWS IAM secret access key |
EKS_CLUSTER_NAME |
EKS cluster name from Terraform output |
Prometheus and Grafana are deployed to the monitoring namespace via the kube-prometheus-stack Helm chart. Metrics are automatically scraped from all cluster workloads including the notesapi pods.
Access Grafana locally:
kubectl port-forward -n monitoring svc/prometheus-grafana 3000:80Open http://localhost:3000. The default login username is admin and retrieve password with:
kubectl get secret -n monitoring prometheus-grafana -o jsonpath="{.data.admin-password}" | base64 --decodeAccess Prometheus locally:
kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090Open http://localhost:9090
