Skip to content

Commit be529a0

Browse files
committed
Added readme, deployment notes and architecture, and configured Host port in Docker compose
1 parent a9bd5bf commit be529a0

8 files changed

Lines changed: 580 additions & 8 deletions

File tree

README.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# AWS Three-Tier Flask Application using Terraform, Docker & GitHub Actions
2+
3+
## Overview
4+
5+
This project demonstrates the deployment of a production-inspired three-tier application on AWS using Infrastructure as Code (Terraform), containerization (Docker), and CI/CD (GitHub Actions).
6+
7+
The infrastructure is completely provisioned using Terraform and supports automatic scaling, load balancing, and secure networking.
8+
9+
---
10+
11+
## Tech Stack
12+
13+
- AWS
14+
- Terraform
15+
- Docker
16+
- Docker Compose
17+
- GitHub Actions
18+
- Flask
19+
- Redis
20+
- PostgreSQL (RDS)
21+
- Auto Scaling Groups
22+
- Application Load Balancers
23+
- CloudWatch
24+
- IAM
25+
26+
---
27+
28+
## Architecture
29+
30+
```
31+
Internet
32+
33+
34+
Internet Gateway
35+
36+
37+
External Application Load Balancer
38+
39+
40+
Frontend Auto Scaling Group
41+
42+
43+
Internal Application Load Balancer
44+
45+
46+
Backend Auto Scaling Group
47+
48+
49+
Amazon RDS PostgreSQL
50+
```
51+
52+
Infrastructure also includes:
53+
54+
- Bastion Host
55+
- NAT Gateway
56+
- Public and Private Subnets
57+
- Route Tables
58+
- IAM Roles
59+
- CloudWatch Alarms
60+
- Security Groups
61+
- Remote Terraform State
62+
63+
---
64+
65+
## Features
66+
67+
- Infrastructure as Code
68+
- Highly Available Architecture
69+
- Multi-AZ Deployment
70+
- Automatic Scaling
71+
- Internal & External Load Balancing
72+
- CI/CD Pipelines
73+
- Dockerized Application
74+
- Bastion Host Access
75+
- Secure Private Networking
76+
- Remote Terraform Backend
77+
78+
---
79+
80+
## Repository Structure
81+
82+
```
83+
.
84+
├── terraform_infra/
85+
│ ├── main.tf
86+
│ ├── variables.tf
87+
│ ├── outputs.tf
88+
│ ├── backend.tf
89+
│ ├── scripts/
90+
│ └── ...
91+
92+
├── .github/
93+
│ └── workflows/
94+
│ ├── docker_pipeline.yml
95+
│ ├── terraform_pipeline.yml
96+
│ ├── terraform_apply.yml
97+
│ └── terraform_destroy.yml
98+
99+
├── Dockerfile
100+
├── docker-compose.yml
101+
├── app.py
102+
├── requirements.txt
103+
└── README.md
104+
```
105+
106+
---
107+
108+
## GitHub Actions
109+
110+
This repository contains four workflows.
111+
112+
### Docker Pipeline
113+
114+
- Build Docker image
115+
- Push to DockerHub
116+
- Smoke Test
117+
118+
### Terraform Pipeline
119+
120+
- fmt
121+
- validate
122+
- plan
123+
124+
### Terraform Apply
125+
126+
Manual Deployment
127+
128+
### Terraform Destroy
129+
130+
Manual Infrastructure Cleanup
131+
132+
---
133+
134+
## Deployment
135+
136+
```bash
137+
terraform init
138+
terraform plan
139+
terraform apply
140+
```
141+
142+
or
143+
144+
Run the GitHub Actions workflow:
145+
146+
Terraform Apply
147+
148+
---
149+
150+
## Future Improvements
151+
152+
- Kubernetes Migration
153+
- Helm Charts
154+
- ArgoCD
155+
- Monitoring using Prometheus
156+
- Grafana
157+
- EKS Deployment
158+
- Service Mesh
159+
160+
---
161+
162+
## Author
163+
164+
Built by Lavanya as part of a Cloud/DevOps learning journey.

architecture.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Infrastructure Architecture
2+
3+
## Components
4+
5+
### Networking
6+
7+
- VPC
8+
- Internet Gateway
9+
- NAT Gateway
10+
- Elastic IP
11+
- Public Subnet
12+
- Frontend Private Subnets
13+
- Backend Private Subnets
14+
- Database Private Subnets
15+
- Route Tables
16+
17+
---
18+
19+
### Security
20+
21+
- Security Groups
22+
- IAM Roles
23+
- IAM Instance Profiles
24+
- Bastion Host
25+
26+
---
27+
28+
### Compute
29+
30+
Frontend Layer
31+
32+
- Launch Template
33+
- Auto Scaling Group
34+
- Docker
35+
- Flask
36+
37+
Backend Layer
38+
39+
- Launch Template
40+
- Auto Scaling Group
41+
- Docker
42+
- Flask API
43+
44+
---
45+
46+
### Load Balancers
47+
48+
External ALB
49+
50+
Receives traffic from Internet
51+
52+
53+
54+
Routes traffic to Frontend ASG
55+
56+
Internal ALB
57+
58+
Receives traffic from Frontend
59+
60+
61+
62+
Routes traffic to Backend ASG
63+
64+
---
65+
66+
### Database
67+
68+
Amazon RDS PostgreSQL
69+
70+
Private Subnet
71+
72+
---
73+
74+
### CI/CD
75+
76+
GitHub
77+
78+
79+
80+
GitHub Actions
81+
82+
83+
84+
Docker Build
85+
86+
87+
88+
DockerHub
89+
90+
91+
92+
Terraform Apply
93+
94+
95+
96+
EC2 User Data
97+
98+
99+
100+
Docker Compose Pull
101+
102+
103+
104+
Application Starts
105+
106+
---
107+
108+
## Request Flow
109+
110+
```
111+
User
112+
113+
114+
115+
External ALB
116+
117+
118+
119+
Frontend ASG
120+
121+
122+
123+
Internal ALB
124+
125+
126+
127+
Backend ASG
128+
129+
130+
131+
RDS
132+
```
133+
134+
---
135+
136+
## Availability
137+
138+
- Multi Availability Zone
139+
- Auto Scaling
140+
- Health Checks
141+
- Target Groups
142+
- CloudWatch Monitoring
143+
144+
---
145+
146+
## Security
147+
148+
- Bastion Host
149+
- Private EC2
150+
- Private Database
151+
- IAM Roles
152+
- Security Groups

0 commit comments

Comments
 (0)