> ## Documentation Index
> Fetch the complete documentation index at: https://docs.grouple.pro/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Infrastructure

> Full AWS infrastructure overview for Grouple

## Architecture

```
GitHub (groupleindia org)
        ↓ auto-deploy
AWS Amplify ──────────────────────────── grouple.pro
        ↓ (frontend)
Route 53
  ├── grouple.pro → Amplify
  └── api.grouple.pro → Application Load Balancer
                              ↓
                    SSL Termination (ACM Certificate)
                              ↓
                    ECS Cluster (grouple-api-cluster)
                      └── Auto Scaling Group
                          ├── EC2 Instance
                          └── EC2 Instance
                              └── ECS Tasks
                                  └── API Containers (Docker)
                                      ← ECR (grouple-api)

AWS Secrets Manager → injects credentials into ECS + EC2

Dedicated EC2 Instance (PM2 AI Workers)
  ├── AI Proposal Worker
  └── PDF Extract Worker
      ↓ both call
Amazon Bedrock (Claude 4.6)

S3 Buckets:
  └── grouple-textract-bucket (document processing)

CloudWatch Logs (/ecs/grouple-api-task)
AWS X-Ray (distributed tracing)
```

## Services Used

### Compute

| Service                   | Purpose                              |
| ------------------------- | ------------------------------------ |
| AWS Amplify               | Frontend hosting + CI/CD from GitHub |
| ECS (grouple-api-cluster) | Containerised backend API            |
| EC2 (Auto Scaling Group)  | ECS host instances                   |
| EC2 (dedicated)           | PM2 AI workers                       |

### Networking

| Service                                    | Purpose                               |
| ------------------------------------------ | ------------------------------------- |
| Route 53                                   | DNS for grouple.pro + api.grouple.pro |
| Application Load Balancer (grouple-api-lb) | HTTP/HTTPS routing to ECS             |
| ACM Certificate                            | SSL/TLS for api.grouple.pro           |
| CloudFront CDN                             | Frontend content delivery             |
| VPC + Subnets + Security Groups            | Network isolation                     |
| Elastic IPs                                | Fixed IPs for EC2 instances           |

### Storage & Registry

| Service                      | Purpose                         |
| ---------------------------- | ------------------------------- |
| ECR (grouple-api)            | Docker image registry           |
| S3 (grouple-textract-bucket) | Document uploads for processing |

### AI & ML

| Service                     | Purpose                                    |
| --------------------------- | ------------------------------------------ |
| Amazon Bedrock (Claude 4.6) | AI proposal generation + PDF extraction    |
| Amazon Textract             | Document OCR (via grouple-textract-bucket) |

### Security & Config

| Service                   | Purpose                               |
| ------------------------- | ------------------------------------- |
| AWS Secrets Manager       | Stores and injects credentials        |
| KMS                       | Encryption keys                       |
| IAM (github-actions-user) | GitHub Actions deployment permissions |

### Observability

| Service         | Purpose                     |
| --------------- | --------------------------- |
| CloudWatch Logs | ECS task logs               |
| AWS X-Ray       | Distributed request tracing |

## CI/CD Pipeline

```
Developer pushes to GitHub main branch
        ↓
GitHub Actions (github-actions-user IAM)
        ↓
├── Frontend: AWS Amplify auto-detects push → builds + deploys
└── Backend: GitHub Actions
    ├── Build Docker image
    ├── Push to ECR (grouple-api)
    └── ECS rolling deployment (new task definition)
```
