The User Data Store is a FastAPI-based microservice that exposes a RESTful API for managing user data, connected to a PostgreSQL backend. It is deployed on Amazon Elastic Kubernetes Service (EKS) with infrastructure provisioned using IaC (Infrastructure as Code) and automated deployment pipelines via GitHub Actions.
This is the production-ready deployment of the User Data Store application using Amazon EKS, FastAPI, PostgreSQL, and GitHub Actions for automated CI/CD. This branch is optimized for cloud-native scalability, reliability, and observability using Kubernetes best practices.
This repository is a work in progress. Expect frequent updates, breaking changes, and evolving features.
- IaC – EKS infrastructure created using GitHub repo: ➡️ User-data-IaC
- AWS account with EKS permissions
- EKS cluster created using the IaC repo
kubectlconfigured to point to the correct cluster- GitHub Actions secrets configured:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGIONEKS_CLUSTER_NAMEECR_REGISTRY_URI
Pushing to this branch triggers a GitHub Actions workflow that:
- Builds Docker image for backend
- Pushes it to Amazon ECR
- Applies Kubernetes manifests (/k8s/*.yaml)
- Verifies successful deployment Monitor progress under the "Actions" tab in GitHub.
# Set KUBECONFIG to EKS cluster
aws eks update-kubeconfig --region <region> --name <cluster-name>
# Apply manifests in order
kubectl apply -f k8s/pvc-eks.yaml
kubectl apply -f k8s/pg16.yaml
kubectl apply -f k8s/backend.yaml# Forward port from service to localhost
kubectl port-forward -n myapp service/backend-service 8008:8008
# Access API documentation
http://localhost:8008/docs├── backend/ # FastAPI application backend
│ ├── __init__.py
│ ├── main.py # Application entry point and FastAPI app creation
│ ├── api/ # API layer
│ │ └── routes/ # API route definitions
│ │ ├── health_routes.py # Health check endpoints
│ │ └── user_routes.py # User management endpoints
│ ├── db/ # Database layer
│ ├── models/ # Data models
│ └── services/ # Business logic layer
├── k8s/ # Kubernetes manifests
│ ├── backend.yaml # Backend deployment and service
│ ├── pg16.yaml # PostgreSQL 16 deployment, service, and secrets
│ ├── pvc.yaml # Persistent Volume Claim for standard storage
│ └── pvc-eks.yaml # PVC for EKS clusters
├── .github/ # GitHub workflows for automated deployment
├── Dockerfile # Multi-stage Docker build
├── requirements.txt # Python dependencies
├── .dockerignore # Docker build exclusions
└── .gitignore # Git exclusions
POSTGRES_HOST=postgres-service
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=testdb
DATABASE_URL=postgresql://postgres:postgres@postgres-service:5432/testdbThese are injected into the container via Kubernetes ConfigMaps or directly in the manifest.
# Check pod status
kubectl get pods -n myapp
# Get logs from backend
kubectl logs -n myapp deployment/backend
# Get logs from DB
kubectl logs -n myapp deployment/postgres-dbFor more debugging tools and techniques, refer to the Wiki