# epruitt/vpcwebsitehosting architecture

> Architecture diagram of the GitHub repository epruitt/vpcwebsitehosting, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/epruitt/vpcwebsitehosting
- Repository: https://github.com/epruitt/vpcwebsitehosting

## Overview

This repository defines secure AWS hosting for the Omnifood static website, with Terraform infrastructure, observability, and a GitHub Actions OIDC deployment foundation. The user-facing path is browser traffic through an Application Load Balancer to a private EC2 web server; website assets are stored in S3 and synced to the instance at boot. CloudWatch and SNS provide monitoring and alerts. The README documents several relationships and capabilities; most Terraform source was not included in the excerpts, so edges reflect documented behavior rather than inspected calls.

Main entry points: [`vpcWebsiteHosting/c5-private-ec2.tf`](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c5-private-ec2.tf) (Private EC2 server), [`vpcWebsiteHosting/modules/vpc/alb.tf`](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/alb.tf) (Application Load Balancer), [`vpcWebsiteHosting/modules/vpc/s3-website-assets.tf`](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/s3-website-assets.tf) (Website assets bucket), [`vpcWebsiteHosting/c6-monitoring.tf`](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c6-monitoring.tf) (Alarms and dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hosting["Hosting infrastructure"]
  node_alb["Application Load Balancer<br/>[alb.tf]"]
  node_vpc["VPC and subnets<br/>[main.tf]"]
  node_instance["Private EC2 server<br/>[c5-private-ec2.tf]"]
  node_instance_role["EC2 IAM role<br/>[ec2-iam-role.tf]"]
end

subgraph group_site["Website delivery"]
  node_assets_bucket[("Website assets bucket")]
  node_asset_upload["Asset uploader<br/>[website-content.tf]"]
  node_website["Omnifood site<br/>[index.html]"]
  node_site_scripts["Site interactions<br/>[script.js]"]
end

subgraph group_observability["Monitoring and alerts"]
  node_cloudwatch_agent["CloudWatch agent config<br/>[agent-config.json]"]
  node_monitoring["Alarms and dashboard<br/>[c6-monitoring.tf]"]
  node_sns["SNS email alerts<br/>[c6-monitoring.tf]"]
end

subgraph group_delivery["Deployment access"]
  node_github["GitHub Actions"]
  node_oidc["GitHub OIDC roles<br/>[oidc.tf]"]
end

node_visitor(("Website visitor"))
node_aws(("AWS"))
node_operator(("Operator"))

node_visitor -->|"requests site"| node_alb
node_alb -->|"forwards traffic"| node_instance
node_vpc -->|"hosts privately"| node_instance
node_assets_bucket -->|"syncs at boot"| node_instance
node_asset_upload -.->|"uploads assets"| node_assets_bucket
node_instance_role -->|"scoped access"| node_assets_bucket
node_website -.->|"uses interactions"| node_site_scripts
node_instance -->|"uses config"| node_cloudwatch_agent
node_instance -->|"provides metrics"| node_monitoring
node_alb -->|"provides metrics"| node_monitoring
node_monitoring -->|"sends alerts"| node_sns
node_sns -->|"emails alerts"| node_operator
node_github -->|"assumes roles"| node_oidc
node_oidc -->|"authorizes deploys"| node_aws
node_operator -->|"connects via SSM"| node_instance

click node_alb "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/alb.tf"
click node_vpc "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/main.tf"
click node_instance "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c5-private-ec2.tf"
click node_instance_role "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/ec2-iam-role.tf"
click node_assets_bucket "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/s3-website-assets.tf"
click node_asset_upload "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/website-content.tf"
click node_website "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/website/index.html"
click node_site_scripts "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/website/js/script.js"
click node_cloudwatch_agent "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/agent-config.json"
click node_monitoring "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c6-monitoring.tf"
click node_sns "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c6-monitoring.tf"
click node_github "https://github.com/epruitt/vpcwebsitehosting/blob/main/.github/workflows/terraform-deploy.yml"
click node_oidc "https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting-bootstrap/oidc.tf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_alb,node_vpc,node_instance,node_instance_role toneBlue
class node_assets_bucket,node_asset_upload,node_website,node_site_scripts toneAmber
class node_cloudwatch_agent,node_monitoring,node_sns toneMint
class node_github,node_oidc toneRose
class node_visitor,node_aws,node_operator toneIndigo
```

## Components

### Hosting infrastructure

- [Application Load Balancer](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/alb.tf): `vpcWebsiteHosting/modules/vpc/alb.tf`
- [VPC and subnets](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/main.tf): `vpcWebsiteHosting/modules/vpc/main.tf`
- [Private EC2 server](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c5-private-ec2.tf): `vpcWebsiteHosting/c5-private-ec2.tf`
- [EC2 IAM role](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/ec2-iam-role.tf): `vpcWebsiteHosting/modules/vpc/ec2-iam-role.tf`

### Website delivery

- [Website assets bucket](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/s3-website-assets.tf): `vpcWebsiteHosting/modules/vpc/s3-website-assets.tf`
- [Asset uploader](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/website-content.tf): `vpcWebsiteHosting/modules/vpc/website-content.tf`
- [Omnifood site](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/website/index.html): `vpcWebsiteHosting/modules/vpc/website/index.html`
- [Site interactions](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/modules/vpc/website/js/script.js): `vpcWebsiteHosting/modules/vpc/website/js/script.js`

### Monitoring and alerts

- [CloudWatch agent config](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/agent-config.json): `vpcWebsiteHosting/agent-config.json`
- [Alarms and dashboard](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c6-monitoring.tf): `vpcWebsiteHosting/c6-monitoring.tf`
- [SNS email alerts](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting/c6-monitoring.tf): `vpcWebsiteHosting/c6-monitoring.tf`

### Deployment access

- [GitHub Actions](https://github.com/epruitt/vpcwebsitehosting/blob/main/.github/workflows/terraform-deploy.yml): `.github/workflows/terraform-deploy.yml`
- [GitHub OIDC roles](https://github.com/epruitt/vpcwebsitehosting/blob/main/vpcWebsiteHosting-bootstrap/oidc.tf): `vpcWebsiteHosting-bootstrap/oidc.tf`

### Other components

- **Website visitor**
- **AWS**
- **Operator**

## Connections

- Website visitor → Application Load Balancer: requests site (evidence: `readme.md`)
- Application Load Balancer → Private EC2 server: forwards traffic (evidence: `readme.md`)
- VPC and subnets → Private EC2 server: hosts privately (evidence: `readme.md`)
- Website assets bucket → Private EC2 server: syncs at boot (evidence: `readme.md`)
- Asset uploader → Website assets bucket: uploads assets
- EC2 IAM role → Website assets bucket: scoped access (evidence: `readme.md`)
- Omnifood site → Site interactions: uses interactions
- Private EC2 server → CloudWatch agent config: uses config (evidence: `readme.md`)
- Private EC2 server → Alarms and dashboard: provides metrics (evidence: `readme.md`)
- Application Load Balancer → Alarms and dashboard: provides metrics (evidence: `readme.md`)
- Alarms and dashboard → SNS email alerts: sends alerts (evidence: `readme.md`)
- SNS email alerts → Operator: emails alerts (evidence: `readme.md`)
- GitHub Actions → GitHub OIDC roles: assumes roles (evidence: `readme.md`)
- GitHub OIDC roles → AWS: authorizes deploys (evidence: `readme.md`)
- Operator → Private EC2 server: connects via SSM (evidence: `readme.md`)
