This project demonstrates deploying an Amazon Prime clone using a set of DevOps tools and practices. The primary tools include:
Terraform: Infrastructure as Code (IaC) tool to create AWS infrastructure such as EC2 instances and EKS clusters.
GitHub: Source code management.
Jenkins: CI/CD automation tool.
SonarQube: Code quality analysis and quality gate tool.
NPM: Build tool for NodeJS.
Aqua Trivy: Security vulnerability scanner.
Docker: Containerization tool to create images.
AWS ECR: Repository to store Docker images.
AWS EKS: Container management platform.
ArgoCD: Continuous deployment tool.
Prometheus & Grafana: Monitoring and alerting tools.
Before getting started, ensure you have:
- AWS Account
- Terraform
- AWS CLI
- Git
- Docker
- Jenkins
- kubectl
- Helm
- Visual Studio Code
- Create an IAM user with programmatic access.
- Save:
- Access Key
- Secret Access Key
Create a key pair named:
key
This will be used to access your EC2 instance.
git clone (Optional) Simplify the VS Code terminal prompt:
code $PROFILE
function prompt {"$PWD > "}
function prompt {$(Get-Location -Leaf) + " > "}Open:
terraform_code/ec2_server/main.tf
Configure AWS credentials:
aws configureInitialize Terraform:
terraform initDeploy infrastructure:
terraform apply --auto-approveTerraform will automatically provision:
- EC2 Instance
- Security Groups
- Jenkins
- Docker
- SonarQube
- Required dependencies
Default Login
Username: admin
Password: admin
Generate a token:
Administration
→ Security
→ Users
→ Tokens
Save the generated token.
Navigate to:
Manage Jenkins
→ Credentials
→ System
→ Global Credentials
Add:
- SonarQube Token
- AWS Access Key
- AWS Secret Key
Install the following plugins:
- SonarQube Scanner
- NodeJS
- Docker
- Prometheus Metrics
Configure:
- JDK 17
- SonarQube Scanner
- NodeJS
- Docker
Create a Jenkins Pipeline using the provided Jenkinsfile.
The pipeline performs:
- Git Checkout
- SonarQube Analysis
- Quality Gate
- Install NPM Dependencies
- Trivy Security Scan
- Docker Build
- Create ECR Repository
- Login to AWS ECR
- Push Docker Image
- Cleanup Docker Images
Deploy your Kubernetes infrastructure using Terraform.
The deployment pipeline automatically:
- Installs ArgoCD
- Exposes ArgoCD Server
- Connects to EKS
The pipeline installs:
- Prometheus
- Grafana
using Helm Charts.
Use ArgoCD to deploy the Kubernetes manifests.
Deployment flow:
GitHub
│
▼
Jenkins CI
│
▼
Docker Image
│
▼
AWS ECR
│
▼
ArgoCD
│
▼
Amazon EKS
Run the Cleanup Pipeline to remove:
- Kubernetes Services
- Deployments
- ArgoCD
- Prometheus
- Grafana
- Helm Releases
- ECR Repository
- KMS Keys
Finally destroy the infrastructure:
terraform destroy- CI Pipeline
- CD Pipeline
- Cleanup Pipeline
Simply copy the Jenkinsfiles provided in this repository into your Jenkins Pipeline jobs.