# mamonaco1973/aws-postgres architecture

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

- Interactive diagram: https://gitdiagram.com/mamonaco1973/aws-postgres
- Repository: https://github.com/mamonaco1973/aws-postgres

## Overview

This repository is Terraform infrastructure for deploying two managed PostgreSQL options on AWS and making them immediately usable for demos. The main workflow is to provision networking and credentials, create RDS PostgreSQL and Aurora PostgreSQL backends, then connect through pgweb and explore the Pagila sample database. The graph preserves the documented RDS replica and Aurora writer/reader distinction. Resource wiring is summarized from the README and file names; sampled source was limited to the diagram generator, so uncertain Terraform-level links are omitted.

Main entry points: [`01-rds/postgres.tf`](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf) (RDS instance), [`01-rds/aurora.tf`](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf) (Aurora writer), [`01-rds/pgweb.tf`](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/pgweb.tf) (pgweb client), [`01-rds/networking.tf`](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/networking.tf) (VPC networking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Network &amp; security"]
  node_networking["VPC networking<br/>[networking.tf]"]
  node_security["Security groups<br/>[security.tf]"]
end

subgraph group_credentials["Credentials"]
  node_secrets["Credentials secrets<br/>[secret.tf]"]
  node_role["AWS roles<br/>[role.tf]"]
end

subgraph group_rds["RDS PostgreSQL"]
  node_rdsconfig["RDS PostgreSQL<br/>[postgres.tf]"]
  node_rdsinstance[("RDS instance<br/>[postgres.tf]")]
  node_replica[("Read replica<br/>[postgres.tf]")]
end

subgraph group_aurora["Aurora PostgreSQL"]
  node_auroraconfig["Aurora cluster<br/>[aurora.tf]"]
  node_aurorawriter[("Aurora writer<br/>[aurora.tf]")]
  node_aurorareader[("Aurora reader<br/>[aurora.tf]")]
end

subgraph group_demo["Demo access"]
  node_pgwebconfig["pgweb provisioning<br/>[pgweb.tf]"]
  node_pgwebinstall["pgweb installer<br/>[install_pgweb.sh]"]
  node_pgweb["pgweb client<br/>[pgweb.tf]"]
  node_pagila["Pagila sample data"]
end

node_operator(("AWS operator"))
node_browser(("Database explorer"))

node_operator -->|"provisions"| node_networking
node_operator -->|"provisions"| node_security
node_operator -->|"provisions"| node_secrets
node_operator -->|"provisions"| node_rdsconfig
node_operator -->|"provisions"| node_auroraconfig
node_operator -->|"provisions"| node_pgwebconfig
node_rdsconfig -->|"creates"| node_rdsinstance
node_rdsconfig -->|"creates"| node_replica
node_auroraconfig -->|"creates"| node_aurorawriter
node_auroraconfig -->|"creates"| node_aurorareader
node_pgwebconfig -->|"uses"| node_pgwebinstall
node_pgwebconfig -->|"provisions"| node_pgweb
node_browser -->|"queries"| node_pgweb
node_pgweb -->|"connects"| node_rdsinstance
node_pgweb -->|"connects"| node_aurorawriter
node_pagila -.->|"loads sample"| node_rdsinstance
node_pagila -.->|"loads sample"| node_aurorawriter
node_networking -->|"hosts"| node_rdsinstance
node_networking -->|"hosts"| node_aurorawriter
node_networking -->|"hosts"| node_pgweb
node_security -->|"guards access"| node_rdsinstance
node_security -->|"guards access"| node_aurorawriter
node_security -->|"guards access"| node_pgweb
node_secrets -->|"stores credentials"| node_rdsinstance
node_secrets -->|"stores credentials"| node_aurorawriter
node_rdsinstance -->|"replicates asynchronously"| node_replica
node_aurorawriter -->|"shares storage"| node_aurorareader

click node_networking "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/networking.tf"
click node_security "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/security.tf"
click node_secrets "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/secret.tf"
click node_role "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/role.tf"
click node_rdsconfig "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf"
click node_rdsinstance "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf"
click node_replica "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf"
click node_auroraconfig "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf"
click node_aurorawriter "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf"
click node_aurorareader "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf"
click node_pgwebconfig "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/pgweb.tf"
click node_pgwebinstall "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/scripts/install_pgweb.sh"
click node_pgweb "https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/pgweb.tf"
click node_pagila "https://github.com/mamonaco1973/aws-postgres/tree/main/01-rds/data"

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_networking,node_security toneBlue
class node_secrets,node_role,node_browser toneAmber
class node_rdsconfig,node_rdsinstance,node_replica toneMint
class node_auroraconfig,node_aurorawriter,node_aurorareader toneRose
class node_pgwebconfig,node_pgwebinstall,node_pgweb,node_pagila,node_operator toneIndigo
```

## Components

### Network & security

- [VPC networking](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/networking.tf): `01-rds/networking.tf`
- [Security groups](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/security.tf): `01-rds/security.tf`

### Credentials

- [Credentials secrets](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/secret.tf): `01-rds/secret.tf`
- [AWS roles](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/role.tf): `01-rds/role.tf`

### RDS PostgreSQL

- [RDS PostgreSQL](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf): `01-rds/postgres.tf`
- [RDS instance](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf): `01-rds/postgres.tf`
- [Read replica](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/postgres.tf): `01-rds/postgres.tf`

### Aurora PostgreSQL

- [Aurora cluster](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf): `01-rds/aurora.tf`
- [Aurora writer](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf): `01-rds/aurora.tf`
- [Aurora reader](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/aurora.tf): `01-rds/aurora.tf`

### Demo access

- [pgweb provisioning](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/pgweb.tf): `01-rds/pgweb.tf`
- [pgweb installer](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/scripts/install_pgweb.sh): `01-rds/scripts/install_pgweb.sh`
- [pgweb client](https://github.com/mamonaco1973/aws-postgres/blob/main/01-rds/pgweb.tf): `01-rds/pgweb.tf`
- [Pagila sample data](https://github.com/mamonaco1973/aws-postgres/tree/main/01-rds/data): `01-rds/data`

### Other components

- **AWS operator**
- **Database explorer**

## Connections

- AWS operator → VPC networking: provisions
- AWS operator → Security groups: provisions
- AWS operator → Credentials secrets: provisions
- AWS operator → RDS PostgreSQL: provisions
- AWS operator → Aurora cluster: provisions
- AWS operator → pgweb provisioning: provisions
- RDS PostgreSQL → RDS instance: creates
- RDS PostgreSQL → Read replica: creates
- Aurora cluster → Aurora writer: creates
- Aurora cluster → Aurora reader: creates
- pgweb provisioning → pgweb installer: uses
- pgweb provisioning → pgweb client: provisions
- Database explorer → pgweb client: queries
- pgweb client → RDS instance: connects
- pgweb client → Aurora writer: connects
- Pagila sample data → RDS instance: loads sample
- Pagila sample data → Aurora writer: loads sample
- VPC networking → RDS instance: hosts
- VPC networking → Aurora writer: hosts
- VPC networking → pgweb client: hosts
- Security groups → RDS instance: guards access
- Security groups → Aurora writer: guards access
- Security groups → pgweb client: guards access
- Credentials secrets → RDS instance: stores credentials
- Credentials secrets → Aurora writer: stores credentials
- RDS instance → Read replica: replicates asynchronously
- Aurora writer → Aurora reader: shares storage
