Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ce33511
Add AWS architecture diagram and documentation
killev May 24, 2025
3fcc647
Migrate infrastructure from MongoDB EC2 to managed services with comp…
killev May 24, 2025
196a33b
Standardize Terraform backend configuration and add initialization sc…
killev May 24, 2025
e5e4b60
Enhance Terraform backend initialization with improved error handling…
killev May 24, 2025
45d75c7
Refactor Terraform configuration and remove DynamoDB state locking
killev May 24, 2025
0bad9ce
Refactor Terraform configuration and split IAM policies
killev May 24, 2025
5f51b9c
Reorganize Terraform IAM policies and simplify Redis configuration
killev May 24, 2025
a3f4473
Add additional AWS permissions to Terraform core management policy
killev May 24, 2025
0ffa8ab
Enhance ECS infrastructure with configurable parameters and auto-scaling
killev May 24, 2025
a6bd59a
Make Terraform configuration more flexible and configurable
killev May 24, 2025
e807885
Update Terraform infrastructure configuration and IAM policies - Enha…
killev May 25, 2025
d824a1d
Update Terraform IAM policies for core and service management
killev May 25, 2025
aa4b964
Replace auto-generated Redis auth token with user-provided variable
killev May 25, 2025
156934d
Enhance AWS infrastructure configuration and S3 setup
killev May 26, 2025
37c7f8a
Add bastion host module for secure SSH access to infrastructure
killev May 26, 2025
b21f767
Improve bastion host configuration and IAM permissions
killev May 26, 2025
ff1a0d0
Add AWS deployment infrastructure and fix configuration issues
killev May 27, 2025
9f1d99d
Add Terraform deployment automation and release tracking
killev May 27, 2025
e72605e
feat: refactor DocumentDB connection to use separate environment vari…
killev May 27, 2025
6d4c974
Improve DocumentDB connection configuration for AWS compatibility
killev May 27, 2025
2851747
Update infrastructure configuration and deployment workflow - Update …
killev May 27, 2025
5d1a159
Merge commit '0db4fcbe6a3b20651351d3131cb2a51467191b61' into create-t…
killev May 27, 2025
5c8bc9e
Standardize environment naming and enhance Terraform configuration
killev May 27, 2025
7e5da24
Restructure infrastructure configuration and update CI/CD workflow
killev May 27, 2025
1b2fece
Update GitHub workflow for Terraform deployment configuration
killev May 27, 2025
15a40d5
Fix GitHub Actions workflow for terraform configuration
killev May 27, 2025
4616764
Reorganize deployment configuration into environments structure
killev May 27, 2025
a53edfa
Fix directory name typo in deployment configuration
killev May 27, 2025
283e35b
Fix Terraform configuration and AWS region in deploy workflow
killev May 27, 2025
4b67b30
Fix terraform plan output path and enable S3 plan storage
killev May 27, 2025
0e79606
Fix Terraform plan file paths in GitHub workflow
killev May 27, 2025
b400800
Fix AWS region configuration in deployment workflow
killev May 27, 2025
88e7564
Simplify GitHub workflow and update ECR repository naming
killev May 28, 2025
8b49799
Update Terraform version to 1.12.0 in apply job
killev May 28, 2025
ad646a3
Fix Terraform lock file consistency issue in GitHub Actions - Add ste…
killev May 28, 2025
03a5c5b
Fix duplicate cd command in terraform apply step
killev May 28, 2025
c2bb29c
Remove duplicate cd deployment command in workflow
killev May 28, 2025
9d2154a
Update Docker build step in AWS deployment workflow
killev May 28, 2025
797968f
Update Docker build configuration and ignore patterns
killev May 28, 2025
50d0594
Simplify ECS secrets configuration in Terraform
killev May 28, 2025
d21c003
Add AWS environment destruction workflow and documentation
killev Jun 5, 2025
5f884d9
Update wget version to 1.25.0-r1 in Dockerfile
killev Jun 5, 2025
b98f1ab
Resolve merge conflicts: keep full implementation and AWS certificate
killev Jun 7, 2025
775bd50
Add conditional approval for AWS environment destruction
killev Jun 7, 2025
168bb71
Add environment specification to destroy workflow jobs
killev Jun 7, 2025
a1aced8
Optimize GitHub Actions destroy workflow conditions
killev Jun 7, 2025
b59b21d
Fix manual approval conditions in destroy AWS environment workflow
killev Jun 7, 2025
3b5bac3
Add force delete option to ECR repository
killev Jun 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions docs/aws-architecture-diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# SF Website AWS Architecture

## Principal AWS Architecture Diagram

```mermaid
flowchart TB
%% External actors
Users[👥 Users]
GitHub[🐙 GitHub Actions CI/CD]

%% Public facing components
ALB[⚖️ Application Load Balancer<br/>sf-website-alb-env<br/>HTTPS Only]
CF[🌐 CloudFront Distribution<br/>sf-website-media-env<br/>CDN for Media Assets]

%% Compute layer
ECS[🚢 ECS Fargate Cluster<br/>sf-website-ecs-cluster-env<br/>Apostrophe CMS App]
ECR[🐳 ECR Repository<br/>sf-website-ecr-env<br/>Container Images]

%% Storage layer
S3_Attachments[🪣 S3 Attachments Bucket<br/>sf-website-s3-attachments-env<br/>Media & Files]
S3_Logs[🪣 S3 Logs Bucket<br/>sf-website-s3-logs-env<br/>Centralized Logs]
MongoDB[📄 MongoDB on EC2<br/>sf-website-mongodb-env<br/>t3.medium + 100GB EBS]

%% Security & Identity
IAM_Task[👤 ECS Task Role<br/>sf-website-ecs-task-env<br/>S3 Access Permissions]
IAM_Exec[👤 ECS Execution Role<br/>sf-website-ecs-execution-env<br/>ECR & Parameter Store]
ParamStore[🔐 Parameter Store<br/>Session Secrets & DB Credentials]

%% Monitoring & Backup
CloudWatch[📊 CloudWatch<br/>sf-website-cloudwatch-env<br/>Logs & Metrics]
AWSBackup[💾 AWS Backup<br/>Daily EBS Snapshots<br/>7 daily, 4 weekly retention]

%% User flows
Users -->|HTTPS requests| ALB
Users -->|Media requests| CF

%% CI/CD flow
GitHub -->|Build & Push| ECR
GitHub -->|Deploy| ECS

%% Load balancer to application
ALB -->|Route traffic| ECS

%% CloudFront to storage
CF -->|Origin requests| S3_Attachments

%% ECS relationships
ECS -->|Pull images| ECR
ECS -->|Read/Write media| S3_Attachments
ECS -->|Database operations| MongoDB
ECS -->|Get secrets| ParamStore
ECS -->|Send logs| CloudWatch

%% IAM relationships
IAM_Task -.->|Assume role| ECS
Copy link

Copilot AI May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a legend to clarify the significance of dashed arrows (used for IAM relationships) versus solid arrows in the Mermaid diagram for better reader comprehension.

Copilot uses AI. Check for mistakes.
IAM_Exec -.->|Assume role| ECS
IAM_Task -.->|S3 permissions| S3_Attachments
IAM_Exec -.->|ECR permissions| ECR
IAM_Exec -.->|Parameter Store| ParamStore

%% Logging flows
ALB -->|Access logs| S3_Logs
CF -->|Access logs| S3_Logs
S3_Attachments -->|Server logs| S3_Logs

%% Monitoring
ECS -->|Metrics & logs| CloudWatch
ALB -->|Metrics| CloudWatch
MongoDB -->|System metrics| CloudWatch

%% Backup
AWSBackup -->|Snapshot| MongoDB
Copy link

Copilot AI May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the documentation to specify that AWS Backup snapshots target the EBS volume of the MongoDB EC2 instance, ensuring clear understanding of what is being backed up.

Copilot uses AI. Check for mistakes.

%% Styling
classDef public fill:#e1f5fe
classDef compute fill:#f3e5f5
classDef storage fill:#e8f5e8
classDef security fill:#fff3e0
classDef monitoring fill:#fce4ec

class ALB,CF public
class ECS,ECR compute
class S3_Attachments,S3_Logs,MongoDB storage
class IAM_Task,IAM_Exec,ParamStore security
class CloudWatch,AWSBackup monitoring
```

## Key Architecture Components

### 🌐 Public Layer
- **Application Load Balancer**: HTTPS-only entry point for web traffic
- **CloudFront**: Global CDN for media asset delivery from S3

### 🚢 Compute Layer
- **ECS Fargate**: Serverless container hosting for Apostrophe CMS
- **ECR**: Private container registry for application images

### 🪣 Storage Layer
- **S3 Attachments**: Media files and uploads from CMS
- **S3 Logs**: Centralized logging for all services
- **MongoDB on EC2**: Primary database with automated backups

### 👤 Security Layer
- **IAM Roles**: Least-privilege access for ECS tasks
- **Parameter Store**: Secure storage for secrets and configuration

### 📊 Operations Layer
- **CloudWatch**: Monitoring, metrics, and alerting
- **AWS Backup**: Automated daily snapshots with retention policies

## Environment Isolation
All resources are tagged and named with environment suffix:
- `dev`, `staging`, `prod`
- Complete isolation between environments
- Consistent naming: `sf-website-<service>-<env>`
Loading