Backup, Disaster Recovery and Migration
For each environment: the services in use, how code goes from a GitHub push to live, what runs, what is backed up, the restore order, and how to move to another AWS account or to GCP. Short steps, service names, honesty badges.
Status: CONFIRMEDDERIVEDREPORTEDUNKNOWN— CONFIRMED = read-only AWS (or Cloudflare) evidence · DERIVED = repository or workflow files · REPORTED = notes from DevOps · UNKNOWN = not found.
PROD at a glance
Native stack in us-east-1, legacy stack in us-east-2. Read-only AWS evidence collected 2026-10-30T14:36Z to 2026-10-30T15:32Z UTC; other regions not checked (UNKNOWN). Cloudflare figures from the read-only inventory of 2026-10-20.
6 high-severity gaps listed at the end of this tab.
Services in use
| Layer | Service | Used for | Region | Count | Status |
|---|---|---|---|---|---|
| Edge | Cloudflare Workers | web, admin and patient front-ends (one Worker per environment) | global | 1 Worker for this environment | DERIVED |
| Edge | Cloudflare DNS (shared zone) | DNS for the app domain; 13 proxied, 18 DNS-only records across all environments | global | 1 zone, 31 records | CONFIRMED |
| Edge | AWS Certificate Manager | TLS certificates for the native API and its domains | us-east-1 | 4 | CONFIRMED |
| Edge | Elastic Load Balancing (ALB) | entry point for the native API (HTTP and HTTPS listeners, TLS 1.3 policy) | us-east-1 | 1 | CONFIRMED |
| Compute | Amazon ECS on Fargate | API service, import worker, payments service | us-east-1 | 3 services | CONFIRMED |
| Compute | Amazon ECR | container images for the ECS services | us-east-1 | 1 repositories, 61 images | CONFIRMED |
| Compute | AWS Lambda (native) | sign-in triggers, error alerts, queue pollers | us-east-1 | 3 | CONFIRMED |
| Compute | AWS Lambda (legacy) | legacy API back-end, scheduled jobs, event handlers | us-east-2 | 56 | CONFIRMED |
| Compute | Amazon API Gateway (REST) | legacy API (567 resources; quota 600) | us-east-2 | 2 | CONFIRMED |
| Compute | Amazon EC2 | database tunnel host | us-east-1 | 1 | CONFIRMED |
| Compute | Amazon EC2 | self-managed document-database host (MongoDB by name) | us-east-2 | 1 | CONFIRMED |
| Compute | Amazon EC2 | purpose UNKNOWN | us-east-2 | 1 | CONFIRMED |
| Data | Amazon Aurora PostgreSQL | native relational database (major version 16) | us-east-1 | 1 | CONFIRMED |
| Data | Amazon RDS for MySQL | legacy MySQL database (major version 8) | us-east-2 | 1 | CONFIRMED |
| Data | Amazon RDS for MySQL | legacy MySQL database (major version 8) | us-east-2 | 1 | CONFIRMED |
| Data | Amazon S3 | documents, uploads, static sites, artifacts, logs, dumps | both | 22 | CONFIRMED |
| Data | Amazon DynamoDB | small tables (alerts, state) | both | 1 | CONFIRMED |
| Messaging | Amazon SQS | work queues and dead-letter queues | both | 7 | CONFIRMED |
| Messaging | Amazon SNS | legacy event fan-out and alert e-mail | both | 50 | CONFIRMED |
| Messaging | Amazon EventBridge | scheduled legacy jobs and event rules | us-east-2 | 12 | CONFIRMED |
| Messaging | Amazon SES | outgoing e-mail | both | 30 identities | CONFIRMED |
| Security | AWS KMS (customer keys) | encryption keys for data and secrets | both | 2 | CONFIRMED |
| Security | AWS Secrets Manager | application credentials (values never read) | both | 11 | CONFIRMED |
| Security | SSM Parameter Store | legacy configuration (values never read) | both | 72 | CONFIRMED |
| Security | AWS IAM | roles (2 trust GitHub OIDC), 7 users | global | 73 | CONFIRMED |
| Operations | Amazon CloudWatch | alarms and log groups | both | 56 alarms, 83 log groups | CONFIRMED |
| Operations | AWS CloudTrail | API audit trail | both | 1 | CONFIRMED |
| Operations | AWS Backup | scheduled backup of the document-database host | us-east-2 | 1 plan | CONFIRMED |
| Delivery | AWS CloudFormation / CDK | native stacks (CDK) and legacy stacks | both | 20 | CONFIRMED |
| Delivery | AWS CodePipeline + CodeBuild | legacy UI and legacy function builds | us-east-2 | 1 pipelines, 1 projects | CONFIRMED |
Checked and not used: ElastiCache, EFS, Elastic Beanstalk, Lightsail, App Runner, Route 53 hosted zones, HTTP APIs (API Gateway v2).
From GitHub push to live
Front-end (Cloudflare Worker)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | manual run only (workflow_dispatch) with a chosen ref; an approval-request job runs first | DERIVED |
| 2 | Build | install, composed front-end build (Node 22) | DERIVED |
| 3 | Approval | GitHub environment 'production' on the deploy job (protection rules live in GitHub settings: UNKNOWN) | DERIVED |
| 4 | Cloud credentials | taken from repository settings; the method is recorded in internal evidence | DERIVED |
| 5 | Deploy | wrangler deploy of the Worker with the commit id as a variable | DERIVED |
| 6 | Smoke test | none in the deploy workflow; a Slack message reports the result | DERIVED |
| 7 | Rollback today | re-run the workflow with the previous ref; Cloudflare keeps earlier Worker versions, but no rollback step is scripted | DERIVED |
Native API (ECS + CDK)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | manual run only (workflow_dispatch) with environment dev/uat/prod and region | DERIVED |
| 2 | Checks | lint, type check, unit tests, build; CI also runs on pull requests | DERIVED |
| 3 | Approval | GitHub environment 'prod' on the deploy job (reviewers: UNKNOWN) | DERIVED |
| 4 | Cloud credentials | GitHub OIDC role (no stored keys in this workflow) | DERIVED |
| 5 | Image build + push | CDK builds the container image from the repository and pushes it to the CDK asset registry | DERIVED |
| 6 | Infrastructure + service deploy | cdk deploy of the environment stack (ECS services, ALB, Aurora, queues, Cognito, Lambda triggers) | DERIVED |
| 7 | Migrations | one-off ECS task runs database migrations after the deploy | DERIVED |
| 8 | Smoke test | HTTP and HTTPS health checks through the load balancer when TLS is enabled | DERIVED |
| 9 | Rollback today | ECS deployment circuit breaker with automatic rollback is on for every service; otherwise re-deploy an earlier ref. Migration rollback: NOT DEFINED | CONFIRMED |
| 10 | Evidence in AWS | latest image push 2026-10-30; latest API service deployment 2026-10-29; latest native stack update 2026-08-24 | CONFIRMED |
Legacy API (Lambda + API Gateway)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | branch pipelines (Bitbucket) and AWS CodePipeline/CodeBuild build zip packages | DERIVED |
| 2 | Function update | the step that updates each function was not found in the local copies | UNKNOWN |
| 3 | API Gateway deploy | stage deployments exist in AWS (929 kept; latest 2026-10-29); the tool that creates them: UNKNOWN | CONFIRMED |
| 4 | Versions / aliases | 0 of 56 legacy functions use an alias, so there is no version to roll back to | CONFIRMED |
| 5 | Evidence in AWS | latest legacy function change 2026-10-29; oldest unchanged since 2020-02-24 | CONFIRMED |
| 6 | Rollback today | re-deploy an earlier package by hand; not documented | UNKNOWN |
Legacy UI (S3 static site)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Build | CodeBuild: install, Angular build | DERIVED |
| 2 | Deploy | empty the hosting bucket, then sync the new build; there is no previous copy to roll back to | DERIVED |
| 3 | Evidence in AWS | 1 pipeline and 1 build project in the legacy region | CONFIRMED |
- database migration rollback
- legacy function deploy step
- smoke tests for the front-end and the legacy API
- who approves each GitHub environment (settings not readable locally)
Running processes
| Process | Where | State | Status |
|---|---|---|---|
| import worker | ECS Fargate | desired 0 · running 0 · autoscaling | CONFIRMED |
| API service | ECS Fargate | desired 2 · running 2 | CONFIRMED |
| payments service | ECS Fargate | desired 2 · running 2 | CONFIRMED |
| Queues | SQS | 7 queues, 3 dead-letter queues; 1 work queue(s) without a dead-letter queue; consumers: 2 Lambda pollers plus the ECS workers | CONFIRMED |
| Scheduled jobs (AWS) | EventBridge | 11 schedules (9 enabled), all targeting legacy Lambda functions | CONFIRMED |
| Scheduled jobs (edge) | Cloudflare Workers | 4 Workers with cron triggers in the shared account (environment split not recorded) | CONFIRMED |
| Legacy event fan-out | SNS -> Lambda | 50 topics; subscriptions by type: email 2, email-json 3, lambda 50 | CONFIRMED |
| E-mail sending | SES | 30 identities; production access on | CONFIRMED |
| Alarms | CloudWatch | 56 alarms, 52 with notification actions, 4 in ALARM at collection | CONFIRMED |
| External API monitor | docs server (outside this account set) | DEV/UAT/PROD API monitors run hourly from the docs server; PROD alerts are kept off (RVQ-150) | CONFIRMED |
| Log retention | CloudWatch Logs | 83 groups, 26 never expire, about 247 GB stored; no export or backup found | CONFIRMED |
| Secrets | Secrets Manager | 11 secrets, kept only in this account; rotation status in internal evidence | CONFIRMED |
| Certificate renewal | ACM + Cloudflare | 4 of 4 ACM certificates eligible for managed renewal; earliest in-use expiry 2026-11-15; edge certificates are managed by Cloudflare | CONFIRMED |
Backups and RTO/RPO
- Approved targets
- Not recorded
- Capability from evidence
- Native database: restore to any point in about the last 14 days (14-day backup retention) CONFIRMED
- Legacy MySQL: restore to any point in the last 1 day(s); older only from manual snapshots CONFIRMED
- Document database host: restore of the whole disk from the last daily recovery point (kept 3 days) CONFIRMED
- Patient documents: earlier object versions where versioning is on; no second copy CONFIRMED
- Users: no Cognito user pools in this account; where user accounts live (legacy database or elsewhere) is UNKNOWN UNKNOWN
- Time to restore: UNKNOWN: never measured (no restore test) UNKNOWN
- Proposed targets
- ______ (for Farhan to approve)
- Last restore test
- date ______ · environment ______ · result ______ (none recorded)
What is backed up
| Component | Region | How | Point-in-time | Encryption | Copies elsewhere | Last backup | Protection / notes | Status |
|---|---|---|---|---|---|---|---|---|
| Native relational database (Aurora PostgreSQL) | us-east-1 | automated backups, 14 days; 4 manual snapshots | point-in-time restore window about 14.2 days; latest restorable point 4 min behind the read | encrypted, customer-managed key | no cross-region or cross-account copy found | 2026-10-30 | deletion protection on; Multi-AZ with 1 reader | CONFIRMED |
| Legacy MySQL database (1 of 2) | us-east-2 | automated backups, 1 day(s); 16 manual snapshots | point-in-time restore window 1 day(s); latest restorable point 2 min behind the read | encrypted | no cross-region copy (automated-backup replication off) | 2026-10-30 | deletion protection OFF; single-AZ | CONFIRMED |
| Legacy MySQL database (2 of 2) | us-east-2 | automated backups, 1 day(s); 0 manual snapshots | point-in-time restore window 1 day(s); latest restorable point 6 min behind the read | NOT encrypted (snapshots also unencrypted) | no cross-region copy (automated-backup replication off) | 2026-10-30 | deletion protection OFF; single-AZ | CONFIRMED |
| Self-managed document database (EC2 host) | us-east-2 | AWS Backup daily plan (3 recovery points kept, 3-day retention, no copy rule) | none (disk-level backups only) | 1 of 1 disks encrypted | none found | 2026-10-30 | single host; no replica | CONFIRMED |
| Patient-documents / uploads bucket (by name) | both | versioning on 2 of 3 | previous object versions only where versioning is on | 0 of 3 with a customer key, rest SSE-S3 | replication on 0 of 3 | not applicable (no backup job) | no second copy | CONFIRMED |
| Patient-related bucket (by name; purpose unverified) | both | versioning on 0 of 3 | none (versioning off on all) | 0 of 3 with a customer key, rest SSE-S3 | replication on 0 of 3 | not applicable (no backup job) | no second copy | CONFIRMED |
| DynamoDB tables | both | point-in-time recovery on 1 of 1 | 35 days where enabled (service default) | encrypted (service default) | none found | no on-demand backups | deletion protection on 0 | CONFIRMED |
| User accounts (Cognito) | - | NO backup: Cognito has no export of password hashes | none | service-managed | none | none | no user pools in this account | CONFIRMED |
| Secrets and parameters | both | kept only in this account (no replica regions, no export) | previous secret version only | KMS | none | none | values must be re-created from a secure store outside AWS; that store is UNKNOWN | CONFIRMED |
| Legacy function code | us-east-2 | copies in source control (local copies seen); deployed packages live only in the account | none | - | UNKNOWN | - | retired runtimes: dotnet6 (5), nodejs12.x (1), python3.7 (3) cannot be created again as they are | CONFIRMED |
| Legacy API definition (API Gateway) | us-east-2 | kept only in the account; no export found | stage can point to an earlier deployment | - | none | - | 567 resources, close to the 600 quota | CONFIRMED |
| Native infrastructure + code | us-east-1 | CDK code and application code in GitHub | git history | - | GitHub | - | best-covered component: can be redeployed from source | DERIVED |
| Container images | us-east-1 | ECR only (61 images, lifecycle policy on 1 of 1) | - | ECR default | no replication | 2026-10-30 | can be rebuilt from GitHub | CONFIRMED |
| Encryption keys (KMS) | both | 2 customer keys, single-region (0 multi-region) | - | - | none (keys cannot be exported) | - | app-level field encryption in the native API uses KMS: data copied elsewhere stays unreadable without this key | CONFIRMED |
| Edge configuration (Cloudflare) | global | Worker code in GitHub (wrangler config); DNS records only in Cloudflare | Worker versions kept by Cloudflare | - | no DNS export found | - | shared zone with 31 records | DERIVED |
| Logs | both | CloudWatch Logs only; no export | - | service-managed | none | - | 26 groups never expire | CONFIRMED |
Who can restore: anyone holding restore permissions in the account; the IAM detail was not analysed (UNKNOWN).
Restore order (same or new region)
Account, access and keys
- Services
- IAM, IAM Identity Center/roles, KMS
- Source of truth
- manual + Terraform kit (iam-roles, kms)
- Approves
- Farhan Chaudry (to confirm)
- Verify
- deploy role can be assumed from GitHub; keys enabled
- Unknown
- break-glass access owner; whether the old key is still usable
Network
- Services
- VPC, subnets, route tables, NAT, security groups, VPC endpoints
- Source of truth
- CDK (native) / Terraform kit (network)
- Approves
- Farhan Chaudry (to confirm)
- Verify
- private subnets reach AWS APIs; database ports reachable from application tasks only
- Unknown
- legacy network not in any code
Data
- Services
- Aurora (snapshot or point-in-time), RDS MySQL (snapshot), EC2 document-DB host (backup), S3 data, Secrets Manager (values re-entered)
- Source of truth
- snapshots / recovery points / secure store
- Approves
- Farhan Chaudry (to confirm)
- Verify
- row counts and a sample read by the app team; secrets present (names only)
- Unknown
- secure store for secret values; consistency between the three databases
Registry
- Services
- ECR
- Source of truth
- GitHub (rebuild) or existing images
- Approves
- release owner
- Verify
- image digest matches the release
- Unknown
- -
Compute
- Services
- ECS services, Lambda (native + legacy), API Gateway (import + stage deploy), Cognito
- Source of truth
- CDK for native; legacy functions and API: Terraform kit + exported definition
- Approves
- Farhan Chaudry (to confirm)
- Verify
- services healthy; API stage answers; sign-in works for a test user
- Unknown
- legacy function packages and API export not yet produced
Edge
- Services
- ACM certificates, Cloudflare DNS and Worker routes
- Source of truth
- Terraform kit (cloudflare) / wrangler
- Approves
- Farhan Chaudry (to confirm)
- Verify
- TLS valid; DNS answers the new origin
- Unknown
- DNS export does not exist yet
CI/CD re-pointed
- Services
- GitHub environments, OIDC role, repository variables
- Source of truth
- GitHub settings
- Approves
- repository admin
- Verify
- a no-op deploy succeeds
- Unknown
- environment reviewers
Validation
- Services
- smoke tests, DEV/UAT/PROD API monitors, CloudWatch alarms
- Source of truth
- monitor + runbooks
- Approves
- Farhan Chaudry (to confirm)
- Verify
- monitors green for one full hour; no new errors
- Unknown
- no written smoke-test list
Cutover and rollback
- Services
- Cloudflare DNS (low TTL), status note
- Source of truth
- runbook
- Approves
- Farhan Chaudry (to confirm)
- Verify
- traffic on the new stack; old stack kept untouched until sign-off
- Unknown
- maintenance-window rules
Move to another AWS account
Prerequisites
- Target account inside the AWS Organization (landing zone, SCPs, budgets)
- BAA coverage for PHI in the target account via AWS Artifact: verify
- Decide region(s) and who owns the account
Access
- IAM Identity Center users/roles
- Break-glass role
- Role-based, short-lived credentials only
Keys
- Create customer-managed KMS keys
- Grant the target account use of the SOURCE keys for snapshot copy
- Snapshots encrypted with the AWS default key cannot be shared: copy them with a customer key first
Terraform state
- State bucket (versioned, encrypted, private) and lock
- Fill the private tfvars
Network
- Apply the network module
- Recreate security groups from the approved design (database ports from application tasks only)
Data
- Aurora: share snapshot -> copy -> restore (or AWS Backup cross-account copy)
- Legacy MySQL: database-level migration (dump/restore or DMS); encrypt it on the way (an unencrypted snapshot cannot become encrypted in place)
- Document-DB host: restore from backup or database dump
- S3: replication or batch copy; keep versions where needed
- Secrets: re-created out-of-band by an approved person
- Cognito: new pool with the user-migration trigger, or password reset for every user (password hashes cannot be exported)
Compute
- Native: cdk deploy into the new account
- ECR: replicate or re-push images
- Legacy Lambda: deploy packages from CI (move retired runtimes first)
- API Gateway: export -> import -> stage deploy -> custom domain + ACM certificate
CI/CD
- GitHub OIDC provider and deploy role in the new account
- Update repository variables per environment
Edge cutover
- Lower DNS TTL in advance
- Switch Cloudflare records to the new origins
- Watch monitors and alarms
Parallel run and decommission
- Run both for an agreed period
- Old account untouched until sign-off
- Decommission after data-retention rules are met
Rollback
- Point DNS back to the old origins
- Data written in the new account during the run must be reconciled: plan needed
Move to GCP (and Azure equivalents)
| AWS today | GCP | Azure |
|---|---|---|
| ECS on Fargate | Cloud Run (or GKE) | Container Apps (or AKS) |
| ALB + WAF | Cloud Load Balancing + Cloud Armor | Application Gateway + WAF / Front Door |
| Aurora PostgreSQL | Cloud SQL for PostgreSQL / AlloyDB (Database Migration Service) | Azure Database for PostgreSQL (DMS) |
| RDS MySQL | Cloud SQL for MySQL (Database Migration Service) | Azure Database for MySQL |
| MongoDB on EC2 | MongoDB on Compute Engine or a managed MongoDB service | Cosmos DB for MongoDB or a VM |
| Lambda | Cloud Run functions | Azure Functions |
| API Gateway (REST) | API Gateway / Apigee | API Management |
| Cognito | Identity Platform | Entra External ID |
| SQS / SNS / EventBridge | Pub/Sub + Cloud Scheduler / Eventarc | Service Bus / Event Grid + timers |
| S3 | Cloud Storage (Storage Transfer Service) | Blob Storage (AzCopy / Storage Mover) |
| DynamoDB | Firestore / Bigtable | Cosmos DB |
| KMS | Cloud KMS | Key Vault |
| Secrets Manager / SSM | Secret Manager | Key Vault |
| ECR | Artifact Registry | Container Registry |
| CloudWatch | Cloud Logging / Monitoring | Azure Monitor |
| CloudTrail | Cloud Audit Logs | Activity Log |
| ACM | Certificate Manager (managed certificates) | managed certificates |
| IAM + GitHub OIDC | IAM + Workload Identity Federation | Entra ID + workload identity federation |
| SES | third-party e-mail service (no direct equivalent) | Azure Communication Services Email |
Step order
- Sign a BAA with the new provider before any PHI moves (verify)
- Reassess PCI scope for the payments service (verify)
- Landing zone: organisation, projects per environment, IAM, budgets
- Network and private service access
- Keys and secrets (re-created; nothing is exported from AWS KMS)
- Databases via Database Migration Service, with a rehearsal
- Storage via Storage Transfer Service
- Rebuild containers to Artifact Registry; deploy to Cloud Run
- Replace Cognito (Identity Platform; users re-verified or reset)
- Port the legacy functions or retire them
- Cloudflare DNS cutover with low TTL
- Parallel run, sign-off, then decommission AWS
Code-change and compliance risks
| Risk | Detail | Effort | Status |
|---|---|---|---|
| Native code calls AWS directly | AWS SDK clients for Lambda (calls into the legacy functions), STS, Secrets Manager, Cognito, S3, KMS, SQS, SES, ECS and DynamoDB appear in the API code | medium-high (estimate) | DERIVED |
| App-level field encryption with KMS | clinical text is encrypted with KMS by the application; it cannot move without decrypting and re-encrypting, or keeping access to the old key | high (estimate) | DERIVED |
| Legacy functions are Lambda-shaped | 56 functions with Lambda and API Gateway event formats, mixed runtimes (.NET, Node.js, Python) | high (estimate) | CONFIRMED |
| Three databases | Aurora PostgreSQL, legacy MySQL and a self-managed document database must stay consistent during a move | high (estimate) | CONFIRMED |
| Users | no Cognito pool in this account; the user store must be identified first | medium (estimate) | UNKNOWN |
| Compliance | HIPAA BAA and PCI scope must be confirmed before any data moves | verify | UNKNOWN |
Effort figures are estimates. Compliance items are marked to verify.
Terraform kit (draft recreate-kit)
Files
| File or folder | Purpose |
|---|---|
| terraform/README.md | purpose, run order, what is not covered |
| terraform/IMPORT-NOTES.md | what cannot be exported and the import/recreate order |
| modules/network | VPC, public/private subnets, NAT, routes, S3 endpoint |
| modules/alb | load balancer, HTTPS listener, redirect, target group, optional WAF |
| modules/ecs-service | Fargate service + task definition, circuit-breaker rollback, autoscaling |
| modules/ecr | repositories, scan on push, lifecycle, optional replication |
| modules/rds | Aurora PostgreSQL (snapshot / point-in-time restore inputs) and optional legacy MySQL |
| modules/lambda-functions | many functions from one map (for_each), code from CI-built packages |
| modules/api-gateway-rest | REST API from an OpenAPI export, stage, domain, optional WAF |
| modules/cognito | user pool with migration trigger |
| modules/sqs-sns | queues with dead-letter queues, topics |
| modules/s3-buckets | private, encrypted, versioned buckets |
| modules/kms | customer keys with rotation, optional cross-account use |
| modules/iam-roles | GitHub OIDC provider and deploy role, ECS roles |
| modules/cloudwatch-alarms | alarms from a map (actions off by default) |
| modules/secrets | empty secret shells, no values |
| modules/cloudflare | DNS records and Worker routes |
| envs/prod/main.tf | wires the modules for this environment |
| envs/prod/variables.tf | inputs |
| envs/prod/backend.tf.example | remote state template |
| envs/prod/terraform.tfvars.example | placeholders only |
Run order
- Create the state bucket and lock in the target account
- Copy the examples in a private working copy; fill the tfvars
- kms -> network -> rds / s3-buckets / secrets / sqs-sns
- ecr -> iam-roles -> alb -> ecs-service
- lambda-functions -> api-gateway-rest -> cognito
- cloudflare (last; this is the cutover)
- cloudwatch-alarms; then the validation step of the restore order
Validation: terraform fmt -check and terraform validate (init without a backend) passed for DEV, UAT and PROD on 2026-10-30 with Terraform 1.17.1. Never planned or applied; no state.
Placeholders only. Never planned or applied; no state. Real values are kept privately and are not linked from here.
Gaps and decisions for Farhan
| Gap | Detail | Severity | Status |
|---|---|---|---|
| No restore test recorded | no AWS Backup restore job and no restore-test record in any evidence | high | CONFIRMED |
| No approved RTO/RPO | no source shows approved targets | high | CONFIRMED |
| Legacy MySQL database | no deletion protection, single-AZ, 1-day backup window | high | CONFIRMED |
| Legacy MySQL database | not encrypted (blocks cross-account copies), no deletion protection, single-AZ, 1-day backup window | high | CONFIRMED |
| Document database backup is short | daily, kept 3 days, no copy outside the account | medium | CONFIRMED |
| No copy outside the account | no cross-region or cross-account copy of databases, buckets, images or secrets | high | CONFIRMED |
| User store not identified | no Cognito pool in this account; where accounts and passwords live is UNKNOWN | medium | UNKNOWN |
| Secrets only in the account | values must be re-created; the secure store is UNKNOWN | high | UNKNOWN |
| Legacy API definition only in the account | no export; near its resource quota | medium | CONFIRMED |
| Legacy deploy step unknown | function packages and their deploy step not found | medium | UNKNOWN |
| Retired Lambda runtimes | dotnet6 (5), nodejs12.x (1), python3.7 (3); cannot be re-created as they are in a new account or region | medium | CONFIRMED |
| Migration rollback not defined | database migrations run on deploy with no down path | medium | DERIVED |
Decisions needed
- Approve RTO and RPO targets per component (or say none yet)
- Schedule the first restore test (environment, component, owner)
- Choose the secure store for secret values
- Confirm the target for a move (another AWS account, GCP or none) and the region
- Decide hosting of this page behind the client-side gate
- Owners for the legacy MySQL, the document database host and the legacy functions
UAT at a glance
Native stack in us-east-1, legacy stack in us-east-2. Read-only AWS evidence collected 2026-10-30T14:36Z to 2026-10-30T15:01Z UTC; other regions not checked (UNKNOWN). Cloudflare figures from the read-only inventory of 2026-10-20.
5 high-severity gaps listed at the end of this tab.
Services in use
| Layer | Service | Used for | Region | Count | Status |
|---|---|---|---|---|---|
| Edge | Cloudflare Workers | web, admin and patient front-ends (one Worker per environment) | global | 1 Worker for this environment | DERIVED |
| Edge | Cloudflare DNS (shared zone) | DNS for the app domain; 13 proxied, 18 DNS-only records across all environments | global | 1 zone, 31 records | CONFIRMED |
| Edge | AWS Certificate Manager | TLS certificates for the native API and its domains | us-east-1 | 6 | CONFIRMED |
| Edge | Elastic Load Balancing (ALB) | entry point for the native API (HTTP and HTTPS listeners, TLS 1.3 policy) | us-east-1 | 1 | CONFIRMED |
| Compute | Amazon ECS on Fargate | API service, import worker, payments service | us-east-1 | 3 services | CONFIRMED |
| Compute | Amazon ECR | container images for the ECS services | us-east-1 | 1 repositories, 83 images | CONFIRMED |
| Compute | AWS Lambda (native) | sign-in triggers, error alerts, queue pollers | us-east-1 | 2 | CONFIRMED |
| Compute | AWS Lambda (legacy) | legacy API back-end, scheduled jobs, event handlers | us-east-2 | 52 | CONFIRMED |
| Compute | Amazon API Gateway (REST) | legacy API (598 resources; quota 600) | us-east-2 | 2 | CONFIRMED |
| Compute | Amazon EC2 | database tunnel host | us-east-1 | 1 | CONFIRMED |
| Compute | Amazon EC2 | self-managed document-database host (MongoDB by name) | us-east-2 | 1 | CONFIRMED |
| Data | Amazon Aurora PostgreSQL | native relational database (major version 16) | us-east-1 | 1 | CONFIRMED |
| Data | Amazon RDS for MySQL | legacy MySQL database (major version 8) | us-east-2 | 1 | CONFIRMED |
| Data | Amazon RDS for MySQL | legacy MySQL database (major version 8) | us-east-2 | 1 | CONFIRMED |
| Data | Amazon S3 | documents, uploads, static sites, artifacts, logs, dumps | both | 17 | CONFIRMED |
| Data | Amazon DynamoDB | small tables (alerts, state) | both | 1 | CONFIRMED |
| Messaging | Amazon SQS | work queues and dead-letter queues | both | 5 | CONFIRMED |
| Messaging | Amazon SNS | legacy event fan-out and alert e-mail | both | 53 | CONFIRMED |
| Messaging | Amazon EventBridge | scheduled legacy jobs and event rules | us-east-2 | 12 | CONFIRMED |
| Messaging | Amazon SES | outgoing e-mail | both | 13 identities | CONFIRMED |
| Security | AWS Secrets Manager | application credentials (values never read) | both | 9 | CONFIRMED |
| Security | SSM Parameter Store | legacy configuration (values never read) | both | 71 | CONFIRMED |
| Security | AWS IAM | roles (2 trust GitHub OIDC), 8 users | global | 58 | CONFIRMED |
| Operations | Amazon CloudWatch | alarms and log groups | both | 4 alarms, 66 log groups | CONFIRMED |
| Delivery | AWS CloudFormation / CDK | native stacks (CDK) and legacy stacks | both | 15 | CONFIRMED |
| Delivery | AWS CodePipeline + CodeBuild | legacy UI and legacy function builds | us-east-2 | 1 pipelines, 1 projects | CONFIRMED |
Checked and not used: ElastiCache, EFS, Elastic Beanstalk, Lightsail, App Runner, Route 53 hosted zones, HTTP APIs (API Gateway v2).
From GitHub push to live
Front-end (Cloudflare Worker)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | push to the uat branch (or manual run); a separate approval-request job runs first | DERIVED |
| 2 | Build | install, composed front-end build (Node 22) | DERIVED |
| 3 | Approval | GitHub environment 'uat' on the deploy job (protection rules live in GitHub settings: UNKNOWN) | DERIVED |
| 4 | Cloud credentials | taken from repository settings; the method is recorded in internal evidence | DERIVED |
| 5 | Deploy | wrangler deploy of the Worker with the commit id as a variable | DERIVED |
| 6 | Smoke test | none in the deploy workflow; a Slack message reports the result | DERIVED |
| 7 | Rollback today | re-run the workflow with the previous ref; Cloudflare keeps earlier Worker versions, but no rollback step is scripted | DERIVED |
Native API (ECS + CDK)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | manual run only (workflow_dispatch) with environment dev/uat/prod and region | DERIVED |
| 2 | Checks | lint, type check, unit tests, build; CI also runs on pull requests | DERIVED |
| 3 | Approval | GitHub environment 'uat' on the deploy job (reviewers: UNKNOWN) | DERIVED |
| 4 | Cloud credentials | GitHub OIDC role (no stored keys in this workflow) | DERIVED |
| 5 | Image build + push | CDK builds the container image from the repository and pushes it to the CDK asset registry | DERIVED |
| 6 | Infrastructure + service deploy | cdk deploy of the environment stack (ECS services, ALB, Aurora, queues, Cognito, Lambda triggers) | DERIVED |
| 7 | Migrations | one-off ECS task runs database migrations after the deploy | DERIVED |
| 8 | Smoke test | HTTP and HTTPS health checks through the load balancer when TLS is enabled | DERIVED |
| 9 | Rollback today | ECS deployment circuit breaker with automatic rollback is on for every service; otherwise re-deploy an earlier ref. Migration rollback: NOT DEFINED | CONFIRMED |
| 10 | Evidence in AWS | latest image push 2026-10-30; latest API service deployment 2026-10-30; latest native stack update 2026-10-30 | CONFIRMED |
Legacy API (Lambda + API Gateway)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | branch pipelines (Bitbucket) and AWS CodePipeline/CodeBuild build zip packages | DERIVED |
| 2 | Function update | the step that updates each function was not found in the local copies | UNKNOWN |
| 3 | API Gateway deploy | stage deployments exist in AWS (1596 kept; latest 2026-10-29); the tool that creates them: UNKNOWN | CONFIRMED |
| 4 | Versions / aliases | 1 of 52 legacy functions use an alias, so there is no version to roll back to | CONFIRMED |
| 5 | Evidence in AWS | latest legacy function change 2026-10-29; oldest unchanged since 2024-04-30 | CONFIRMED |
| 6 | Rollback today | re-deploy an earlier package by hand; not documented | UNKNOWN |
Legacy UI (S3 static site)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Build | CodeBuild: install, Angular build | DERIVED |
| 2 | Deploy | empty the hosting bucket, then sync the new build; there is no previous copy to roll back to | DERIVED |
| 3 | Evidence in AWS | 1 pipeline and 1 build project in the legacy region | CONFIRMED |
- database migration rollback
- legacy function deploy step
- smoke tests for the front-end and the legacy API
- who approves each GitHub environment (settings not readable locally)
Running processes
| Process | Where | State | Status |
|---|---|---|---|
| payments service | ECS Fargate | desired 1 · running 1 | CONFIRMED |
| import worker | ECS Fargate | desired 0 · running 0 · autoscaling | CONFIRMED |
| API service | ECS Fargate | desired 1 · running 1 | CONFIRMED |
| Queues | SQS | 5 queues, 2 dead-letter queues; 1 work queue(s) without a dead-letter queue; consumers: 1 Lambda pollers plus the ECS workers | CONFIRMED |
| Scheduled jobs (AWS) | EventBridge | 10 schedules (8 enabled), all targeting legacy Lambda functions | CONFIRMED |
| Scheduled jobs (edge) | Cloudflare Workers | 4 Workers with cron triggers in the shared account (environment split not recorded) | CONFIRMED |
| Legacy event fan-out | SNS -> Lambda | 53 topics; subscriptions by type: email-json 12, lambda 50 | CONFIRMED |
| E-mail sending | SES | 13 identities; production access on | CONFIRMED |
| Alarms | CloudWatch | 4 alarms, 2 with notification actions, 0 in ALARM at collection | CONFIRMED |
| External API monitor | docs server (outside this account set) | DEV/UAT/PROD API monitors run hourly from the docs server; PROD alerts are kept off (RVQ-150) | CONFIRMED |
| Log retention | CloudWatch Logs | 66 groups, 60 never expire, about 15 GB stored; no export or backup found | CONFIRMED |
| Secrets | Secrets Manager | 9 secrets, kept only in this account; rotation status in internal evidence | CONFIRMED |
| Certificate renewal | ACM + Cloudflare | 5 of 6 ACM certificates eligible for managed renewal; earliest in-use expiry 2027-02-13; edge certificates are managed by Cloudflare | CONFIRMED |
Backups and RTO/RPO
- Approved targets
- Not recorded
- Capability from evidence
- Native database: restore to any point in about the last 3 days (3-day backup retention) CONFIRMED
- Legacy MySQL: restore to any point in the last 3 day(s); older only from manual snapshots CONFIRMED
- Document database host: no restore point unless an EBS snapshot exists CONFIRMED
- Patient documents: earlier object versions where versioning is on; no second copy CONFIRMED
- Users: no Cognito user pools in this account; where user accounts live (legacy database or elsewhere) is UNKNOWN UNKNOWN
- Time to restore: UNKNOWN: never measured (no restore test) UNKNOWN
- Proposed targets
- ______ (for Farhan to approve)
- Last restore test
- date ______ · environment ______ · result ______ (none recorded)
What is backed up
| Component | Region | How | Point-in-time | Encryption | Copies elsewhere | Last backup | Protection / notes | Status |
|---|---|---|---|---|---|---|---|---|
| Native relational database (Aurora PostgreSQL) | us-east-1 | automated backups, 3 days; 2 manual snapshots | point-in-time restore window about 3.3 days; latest restorable point 2 min behind the read | encrypted, customer-managed key | no cross-region or cross-account copy found | 2026-10-30 | deletion protection OFF; single-AZ (no reader) | CONFIRMED |
| Legacy MySQL database (1 of 2) | us-east-2 | automated backups, 3 day(s); 2 manual snapshots | point-in-time restore window 3 day(s); latest restorable point 6 min behind the read | encrypted | no cross-region copy (automated-backup replication off) | 2026-10-30 | deletion protection OFF; single-AZ | CONFIRMED |
| Legacy MySQL database (2 of 2) | us-east-2 | automated backups, 3 day(s); 0 manual snapshots | point-in-time restore window 3 day(s); latest restorable point 2 min behind the read | NOT encrypted (snapshots also unencrypted) | no cross-region copy (automated-backup replication off) | 2026-10-30 | deletion protection OFF; single-AZ | CONFIRMED |
| Self-managed document database (EC2 host) | us-east-2 | NO backup found (no AWS Backup plan, no EBS snapshot) | none (disk-level backups only) | 1 of 1 disks encrypted | none found | none | single host; no replica | CONFIRMED |
| Patient-documents / uploads bucket (by name) | both | versioning on 2 of 3 | previous object versions only where versioning is on | 0 of 3 with a customer key, rest SSE-S3 | replication on 0 of 3 | not applicable (no backup job) | no second copy | CONFIRMED |
| Patient-related bucket (by name; purpose unverified) | both | versioning on 0 of 2 | none (versioning off on all) | 0 of 2 with a customer key, rest SSE-S3 | replication on 0 of 2 | not applicable (no backup job) | no second copy | CONFIRMED |
| DynamoDB tables | both | point-in-time recovery on 0 of 1 | 35 days where enabled (service default) | encrypted (service default) | none found | no on-demand backups | deletion protection on 0 | CONFIRMED |
| User accounts (Cognito) | - | NO backup: Cognito has no export of password hashes | none | service-managed | none | none | no user pools in this account | CONFIRMED |
| Secrets and parameters | both | kept only in this account (no replica regions, no export) | previous secret version only | KMS | none | none | values must be re-created from a secure store outside AWS; that store is UNKNOWN | CONFIRMED |
| Legacy function code | us-east-2 | copies in source control (local copies seen); deployed packages live only in the account | none | - | UNKNOWN | - | retired runtimes: dotnet6 (5) cannot be created again as they are | CONFIRMED |
| Legacy API definition (API Gateway) | us-east-2 | kept only in the account; no export found | stage can point to an earlier deployment | - | none | - | 598 resources, close to the 600 quota | CONFIRMED |
| Native infrastructure + code | us-east-1 | CDK code and application code in GitHub | git history | - | GitHub | - | best-covered component: can be redeployed from source | DERIVED |
| Container images | us-east-1 | ECR only (83 images, lifecycle policy on 1 of 1) | - | ECR default | no replication | 2026-10-30 | can be rebuilt from GitHub | CONFIRMED |
| Encryption keys (KMS) | both | 0 customer keys, single-region (0 multi-region) | - | - | none (keys cannot be exported) | - | app-level field encryption in the native API uses KMS: data copied elsewhere stays unreadable without this key | CONFIRMED |
| Edge configuration (Cloudflare) | global | Worker code in GitHub (wrangler config); DNS records only in Cloudflare | Worker versions kept by Cloudflare | - | no DNS export found | - | shared zone with 31 records | DERIVED |
| Logs | both | CloudWatch Logs only; no export | - | service-managed | none | - | 60 groups never expire | CONFIRMED |
Who can restore: anyone holding restore permissions in the account; the IAM detail was not analysed (UNKNOWN).
Restore order (same or new region)
Account, access and keys
- Services
- IAM, IAM Identity Center/roles, KMS
- Source of truth
- manual + Terraform kit (iam-roles, kms)
- Approves
- Farhan Chaudry (to confirm)
- Verify
- deploy role can be assumed from GitHub; keys enabled
- Unknown
- break-glass access owner; whether the old key is still usable
Network
- Services
- VPC, subnets, route tables, NAT, security groups, VPC endpoints
- Source of truth
- CDK (native) / Terraform kit (network)
- Approves
- Farhan Chaudry (to confirm)
- Verify
- private subnets reach AWS APIs; database ports reachable from application tasks only
- Unknown
- legacy network not in any code
Data
- Services
- Aurora (snapshot or point-in-time), RDS MySQL (snapshot), EC2 document-DB host (backup), S3 data, Secrets Manager (values re-entered)
- Source of truth
- snapshots / recovery points / secure store
- Approves
- Farhan Chaudry (to confirm)
- Verify
- row counts and a sample read by the app team; secrets present (names only)
- Unknown
- secure store for secret values; consistency between the three databases
Registry
- Services
- ECR
- Source of truth
- GitHub (rebuild) or existing images
- Approves
- release owner
- Verify
- image digest matches the release
- Unknown
- -
Compute
- Services
- ECS services, Lambda (native + legacy), API Gateway (import + stage deploy), Cognito
- Source of truth
- CDK for native; legacy functions and API: Terraform kit + exported definition
- Approves
- Farhan Chaudry (to confirm)
- Verify
- services healthy; API stage answers; sign-in works for a test user
- Unknown
- legacy function packages and API export not yet produced
Edge
- Services
- ACM certificates, Cloudflare DNS and Worker routes
- Source of truth
- Terraform kit (cloudflare) / wrangler
- Approves
- Farhan Chaudry (to confirm)
- Verify
- TLS valid; DNS answers the new origin
- Unknown
- DNS export does not exist yet
CI/CD re-pointed
- Services
- GitHub environments, OIDC role, repository variables
- Source of truth
- GitHub settings
- Approves
- repository admin
- Verify
- a no-op deploy succeeds
- Unknown
- environment reviewers
Validation
- Services
- smoke tests, DEV/UAT/PROD API monitors, CloudWatch alarms
- Source of truth
- monitor + runbooks
- Approves
- Farhan Chaudry (to confirm)
- Verify
- monitors green for one full hour; no new errors
- Unknown
- no written smoke-test list
Cutover and rollback
- Services
- Cloudflare DNS (low TTL), status note
- Source of truth
- runbook
- Approves
- Farhan Chaudry (to confirm)
- Verify
- traffic on the new stack; old stack kept untouched until sign-off
- Unknown
- maintenance-window rules
Move to another AWS account
Prerequisites
- Target account inside the AWS Organization (landing zone, SCPs, budgets)
- BAA coverage for PHI in the target account via AWS Artifact: verify
- Decide region(s) and who owns the account
Access
- IAM Identity Center users/roles
- Break-glass role
- Role-based, short-lived credentials only
Keys
- Create customer-managed KMS keys
- Grant the target account use of the SOURCE keys for snapshot copy
- Snapshots encrypted with the AWS default key cannot be shared: copy them with a customer key first
Terraform state
- State bucket (versioned, encrypted, private) and lock
- Fill the private tfvars
Network
- Apply the network module
- Recreate security groups from the approved design (database ports from application tasks only)
Data
- Aurora: share snapshot -> copy -> restore (or AWS Backup cross-account copy)
- Legacy MySQL: database-level migration (dump/restore or DMS); encrypt it on the way (an unencrypted snapshot cannot become encrypted in place)
- Document-DB host: restore from backup or database dump
- S3: replication or batch copy; keep versions where needed
- Secrets: re-created out-of-band by an approved person
- Cognito: new pool with the user-migration trigger, or password reset for every user (password hashes cannot be exported)
Compute
- Native: cdk deploy into the new account
- ECR: replicate or re-push images
- Legacy Lambda: deploy packages from CI (move retired runtimes first)
- API Gateway: export -> import -> stage deploy -> custom domain + ACM certificate
CI/CD
- GitHub OIDC provider and deploy role in the new account
- Update repository variables per environment
Edge cutover
- Lower DNS TTL in advance
- Switch Cloudflare records to the new origins
- Watch monitors and alarms
Parallel run and decommission
- Run both for an agreed period
- Old account untouched until sign-off
- Decommission after data-retention rules are met
Rollback
- Point DNS back to the old origins
- Data written in the new account during the run must be reconciled: plan needed
Move to GCP (and Azure equivalents)
| AWS today | GCP | Azure |
|---|---|---|
| ECS on Fargate | Cloud Run (or GKE) | Container Apps (or AKS) |
| ALB + WAF | Cloud Load Balancing + Cloud Armor | Application Gateway + WAF / Front Door |
| Aurora PostgreSQL | Cloud SQL for PostgreSQL / AlloyDB (Database Migration Service) | Azure Database for PostgreSQL (DMS) |
| RDS MySQL | Cloud SQL for MySQL (Database Migration Service) | Azure Database for MySQL |
| MongoDB on EC2 | MongoDB on Compute Engine or a managed MongoDB service | Cosmos DB for MongoDB or a VM |
| Lambda | Cloud Run functions | Azure Functions |
| API Gateway (REST) | API Gateway / Apigee | API Management |
| Cognito | Identity Platform | Entra External ID |
| SQS / SNS / EventBridge | Pub/Sub + Cloud Scheduler / Eventarc | Service Bus / Event Grid + timers |
| S3 | Cloud Storage (Storage Transfer Service) | Blob Storage (AzCopy / Storage Mover) |
| DynamoDB | Firestore / Bigtable | Cosmos DB |
| KMS | Cloud KMS | Key Vault |
| Secrets Manager / SSM | Secret Manager | Key Vault |
| ECR | Artifact Registry | Container Registry |
| CloudWatch | Cloud Logging / Monitoring | Azure Monitor |
| CloudTrail | Cloud Audit Logs | Activity Log |
| ACM | Certificate Manager (managed certificates) | managed certificates |
| IAM + GitHub OIDC | IAM + Workload Identity Federation | Entra ID + workload identity federation |
| SES | third-party e-mail service (no direct equivalent) | Azure Communication Services Email |
Step order
- Sign a BAA with the new provider before any PHI moves (verify)
- Reassess PCI scope for the payments service (verify)
- Landing zone: organisation, projects per environment, IAM, budgets
- Network and private service access
- Keys and secrets (re-created; nothing is exported from AWS KMS)
- Databases via Database Migration Service, with a rehearsal
- Storage via Storage Transfer Service
- Rebuild containers to Artifact Registry; deploy to Cloud Run
- Replace Cognito (Identity Platform; users re-verified or reset)
- Port the legacy functions or retire them
- Cloudflare DNS cutover with low TTL
- Parallel run, sign-off, then decommission AWS
Code-change and compliance risks
| Risk | Detail | Effort | Status |
|---|---|---|---|
| Native code calls AWS directly | AWS SDK clients for Lambda (calls into the legacy functions), STS, Secrets Manager, Cognito, S3, KMS, SQS, SES, ECS and DynamoDB appear in the API code | medium-high (estimate) | DERIVED |
| App-level field encryption with KMS | clinical text is encrypted with KMS by the application; it cannot move without decrypting and re-encrypting, or keeping access to the old key | high (estimate) | DERIVED |
| Legacy functions are Lambda-shaped | 52 functions with Lambda and API Gateway event formats, mixed runtimes (.NET, Node.js, Python) | high (estimate) | CONFIRMED |
| Three databases | Aurora PostgreSQL, legacy MySQL and a self-managed document database must stay consistent during a move | high (estimate) | CONFIRMED |
| Users | no Cognito pool in this account; the user store must be identified first | medium (estimate) | UNKNOWN |
| Compliance | HIPAA BAA and PCI scope must be confirmed before any data moves | verify | UNKNOWN |
Effort figures are estimates. Compliance items are marked to verify.
Terraform kit (draft recreate-kit)
Files
| File or folder | Purpose |
|---|---|
| terraform/README.md | purpose, run order, what is not covered |
| terraform/IMPORT-NOTES.md | what cannot be exported and the import/recreate order |
| modules/network | VPC, public/private subnets, NAT, routes, S3 endpoint |
| modules/alb | load balancer, HTTPS listener, redirect, target group, optional WAF |
| modules/ecs-service | Fargate service + task definition, circuit-breaker rollback, autoscaling |
| modules/ecr | repositories, scan on push, lifecycle, optional replication |
| modules/rds | Aurora PostgreSQL (snapshot / point-in-time restore inputs) and optional legacy MySQL |
| modules/lambda-functions | many functions from one map (for_each), code from CI-built packages |
| modules/api-gateway-rest | REST API from an OpenAPI export, stage, domain, optional WAF |
| modules/cognito | user pool with migration trigger |
| modules/sqs-sns | queues with dead-letter queues, topics |
| modules/s3-buckets | private, encrypted, versioned buckets |
| modules/kms | customer keys with rotation, optional cross-account use |
| modules/iam-roles | GitHub OIDC provider and deploy role, ECS roles |
| modules/cloudwatch-alarms | alarms from a map (actions off by default) |
| modules/secrets | empty secret shells, no values |
| modules/cloudflare | DNS records and Worker routes |
| envs/uat/main.tf | wires the modules for this environment |
| envs/uat/variables.tf | inputs |
| envs/uat/backend.tf.example | remote state template |
| envs/uat/terraform.tfvars.example | placeholders only |
Run order
- Create the state bucket and lock in the target account
- Copy the examples in a private working copy; fill the tfvars
- kms -> network -> rds / s3-buckets / secrets / sqs-sns
- ecr -> iam-roles -> alb -> ecs-service
- lambda-functions -> api-gateway-rest -> cognito
- cloudflare (last; this is the cutover)
- cloudwatch-alarms; then the validation step of the restore order
Validation: terraform fmt -check and terraform validate (init without a backend) passed for DEV, UAT and PROD on 2026-10-30 with Terraform 1.17.1. Never planned or applied; no state.
Placeholders only. Never planned or applied; no state. Real values are kept privately and are not linked from here.
Gaps and decisions for Farhan
| Gap | Detail | Severity | Status |
|---|---|---|---|
| No restore test recorded | no AWS Backup restore job and no restore-test record in any evidence | high | CONFIRMED |
| No approved RTO/RPO | no source shows approved targets | high | CONFIRMED |
| Legacy MySQL database | no deletion protection, single-AZ | medium | CONFIRMED |
| Legacy MySQL database | not encrypted (blocks cross-account copies), no deletion protection, single-AZ | medium | CONFIRMED |
| Native database | no deletion protection, single-AZ | medium | CONFIRMED |
| Document database host has no backup | no AWS Backup plan and no disk snapshot | high | CONFIRMED |
| No copy outside the account | no cross-region or cross-account copy of databases, buckets, images or secrets | high | CONFIRMED |
| User store not identified | no Cognito pool in this account; where accounts and passwords live is UNKNOWN | medium | UNKNOWN |
| Secrets only in the account | values must be re-created; the secure store is UNKNOWN | high | UNKNOWN |
| Legacy API definition only in the account | no export; near its resource quota | medium | CONFIRMED |
| Legacy deploy step unknown | function packages and their deploy step not found | medium | UNKNOWN |
| Retired Lambda runtimes | dotnet6 (5); cannot be re-created as they are in a new account or region | medium | CONFIRMED |
| Migration rollback not defined | database migrations run on deploy with no down path | medium | DERIVED |
Decisions needed
- Approve RTO and RPO targets per component (or say none yet)
- Schedule the first restore test (environment, component, owner)
- Choose the secure store for secret values
- Confirm the target for a move (another AWS account, GCP or none) and the region
- Decide hosting of this page behind the client-side gate
- Owners for the legacy MySQL, the document database host and the legacy functions
DEV at a glance
Native stack in us-east-1, legacy stack in us-east-2. Read-only AWS evidence collected 2026-10-30T14:36Z to 2026-10-30T15:01Z UTC; other regions not checked (UNKNOWN). Cloudflare figures from the read-only inventory of 2026-10-20.
6 high-severity gaps listed at the end of this tab.
Services in use
| Layer | Service | Used for | Region | Count | Status |
|---|---|---|---|---|---|
| Edge | Cloudflare Workers | web, admin and patient front-ends (one Worker per environment) | global | 1 Worker for this environment | DERIVED |
| Edge | Cloudflare DNS (shared zone) | DNS for the app domain; 13 proxied, 18 DNS-only records across all environments | global | 1 zone, 31 records | CONFIRMED |
| Edge | AWS Certificate Manager | TLS certificates for the native API and its domains | us-east-1 | 4 | CONFIRMED |
| Edge | Elastic Load Balancing (ALB) | entry point for the native API (HTTP and HTTPS listeners, TLS 1.3 policy) | us-east-1 | 1 | CONFIRMED |
| Compute | Amazon ECS on Fargate | API service, payments service | us-east-1 | 2 services | CONFIRMED |
| Compute | Amazon ECR | container images for the ECS services | us-east-1 | 3 repositories, 208 images | CONFIRMED |
| Compute | AWS Lambda (native) | sign-in triggers, error alerts, queue pollers | us-east-1 | 11 | CONFIRMED |
| Compute | AWS Lambda (legacy) | legacy API back-end, scheduled jobs, event handlers | us-east-2 | 71 | CONFIRMED |
| Compute | Amazon API Gateway (REST) | legacy API (574 resources; quota 600) | us-east-2 | 2 | CONFIRMED |
| Compute | Amazon EC2 | database tunnel host | us-east-1 | 1 | CONFIRMED |
| Compute | Amazon EC2 | self-managed document-database host (MongoDB by name) | us-east-2 | 1 | CONFIRMED |
| Compute | Amazon EC2 | purpose UNKNOWN | us-east-2 | 1 | CONFIRMED |
| Compute | Amazon EC2 | docs web server | us-east-2 | 1 | CONFIRMED |
| Identity | Amazon Cognito | user sign-in pools | us-east-1 | 4 | CONFIRMED |
| Identity | Amazon Cognito | legacy user pools | us-east-2 | 3 | CONFIRMED |
| Data | Amazon Aurora PostgreSQL | native relational database (major version 16) | us-east-1 | 1 | CONFIRMED |
| Data | Amazon RDS for MySQL | legacy MySQL database (major version 8) | us-east-2 | 1 | CONFIRMED |
| Data | Amazon S3 | documents, uploads, static sites, artifacts, logs, dumps | both | 40 | CONFIRMED |
| Data | Amazon DynamoDB | small tables (alerts, state) | both | 4 | CONFIRMED |
| Messaging | Amazon SQS | work queues and dead-letter queues | both | 7 | CONFIRMED |
| Messaging | Amazon SNS | legacy event fan-out and alert e-mail | both | 78 | CONFIRMED |
| Messaging | Amazon EventBridge | scheduled legacy jobs and event rules | us-east-2 | 34 | CONFIRMED |
| Messaging | Amazon SES | outgoing e-mail | both | 14 identities | CONFIRMED |
| Messaging | AWS Step Functions | workflow | both | 1 | CONFIRMED |
| Security | AWS KMS (customer keys) | encryption keys for data and secrets | both | 5 | CONFIRMED |
| Security | AWS Secrets Manager | application credentials (values never read) | both | 16 | CONFIRMED |
| Security | SSM Parameter Store | legacy configuration (values never read) | both | 72 | CONFIRMED |
| Security | AWS IAM | roles (3 trust GitHub OIDC), 8 users | global | 174 | CONFIRMED |
| Operations | Amazon CloudWatch | alarms and log groups | both | 8 alarms, 114 log groups | CONFIRMED |
| Operations | AWS CloudTrail | API audit trail | both | 1 | CONFIRMED |
| Delivery | AWS CloudFormation / CDK | native stacks (CDK) and legacy stacks | both | 53 | CONFIRMED |
| Delivery | AWS CodePipeline + CodeBuild | legacy UI and legacy function builds | us-east-2 | 17 pipelines, 22 projects | CONFIRMED |
| Delivery | AWS Amplify | front-end hosting (purpose UNKNOWN) | both | 3 | CONFIRMED |
Checked and not used: ElastiCache, EFS, Elastic Beanstalk, Lightsail, App Runner, Route 53 hosted zones, HTTP APIs (API Gateway v2).
From GitHub push to live
Front-end (Cloudflare Worker)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | push to the develop branch (or manual run) | DERIVED |
| 2 | Build | install, composed front-end build (Node 22) | DERIVED |
| 3 | Approval | GitHub environment 'develop' on the deploy job (protection rules live in GitHub settings: UNKNOWN) | DERIVED |
| 4 | Cloud credentials | taken from repository settings; the method is recorded in internal evidence | DERIVED |
| 5 | Deploy | wrangler deploy of the Worker with the commit id as a variable | DERIVED |
| 6 | Smoke test | none in the deploy workflow; a Slack message reports the result | DERIVED |
| 7 | Rollback today | re-run the workflow with the previous ref; Cloudflare keeps earlier Worker versions, but no rollback step is scripted | DERIVED |
Native API (ECS + CDK)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | manual run only (workflow_dispatch) with environment dev/uat/prod and region | DERIVED |
| 2 | Checks | lint, type check, unit tests, build; CI also runs on pull requests | DERIVED |
| 3 | Approval | GitHub environment 'dev' on the deploy job (reviewers: UNKNOWN) | DERIVED |
| 4 | Cloud credentials | GitHub OIDC role (no stored keys in this workflow) | DERIVED |
| 5 | Image build + push | CDK builds the container image from the repository and pushes it to the CDK asset registry | DERIVED |
| 6 | Infrastructure + service deploy | cdk deploy of the environment stack (ECS services, ALB, Aurora, queues, Cognito, Lambda triggers) | DERIVED |
| 7 | Migrations | one-off ECS task runs database migrations after the deploy | DERIVED |
| 8 | Smoke test | HTTP and HTTPS health checks through the load balancer when TLS is enabled | DERIVED |
| 9 | Rollback today | ECS deployment circuit breaker with automatic rollback is on for every service; otherwise re-deploy an earlier ref. Migration rollback: NOT DEFINED | CONFIRMED |
| 10 | Evidence in AWS | latest image push 2026-10-16; latest API service deployment 2026-10-24; latest native stack update 2026-10-16 | CONFIRMED |
Legacy API (Lambda + API Gateway)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Trigger | branch pipelines (Bitbucket) and AWS CodePipeline/CodeBuild build zip packages | DERIVED |
| 2 | Function update | the step that updates each function was not found in the local copies | UNKNOWN |
| 3 | API Gateway deploy | stage deployments exist in AWS (5394 kept; latest 2026-10-29); the tool that creates them: UNKNOWN | CONFIRMED |
| 4 | Versions / aliases | 1 of 71 legacy functions use an alias, so there is no version to roll back to | CONFIRMED |
| 5 | Evidence in AWS | latest legacy function change 2026-10-29; oldest unchanged since 2024-09-05 | CONFIRMED |
| 6 | Rollback today | re-deploy an earlier package by hand; not documented | UNKNOWN |
Legacy UI (S3 static site)
| # | Step | What happens | Status |
|---|---|---|---|
| 1 | Build | CodeBuild: install, Angular build | DERIVED |
| 2 | Deploy | empty the hosting bucket, then sync the new build; there is no previous copy to roll back to | DERIVED |
| 3 | Evidence in AWS | 17 pipelines and 22 build projects in the legacy region | CONFIRMED |
- database migration rollback
- legacy function deploy step
- smoke tests for the front-end and the legacy API
- who approves each GitHub environment (settings not readable locally)
Running processes
| Process | Where | State | Status |
|---|---|---|---|
| payments service | ECS Fargate | desired 1 · running 0 | CONFIRMED |
| API service | ECS Fargate | desired 1 · running 1 | CONFIRMED |
| Queues | SQS | 7 queues, 2 dead-letter queues; 3 work queue(s) without a dead-letter queue; consumers: 2 Lambda pollers plus the ECS workers | CONFIRMED |
| Scheduled jobs (AWS) | EventBridge | 10 schedules (8 enabled), all targeting legacy Lambda functions | CONFIRMED |
| Scheduled jobs (edge) | Cloudflare Workers | 4 Workers with cron triggers in the shared account (environment split not recorded) | CONFIRMED |
| Legacy event fan-out | SNS -> Lambda | 78 topics; subscriptions by type: email 4, email-json 33, https 14, lambda 54 | CONFIRMED |
| E-mail sending | SES | 14 identities; production access off (sandbox) | CONFIRMED |
| Alarms | CloudWatch | 8 alarms, 4 with notification actions, 1 in ALARM at collection | CONFIRMED |
| External API monitor | docs server (outside this account set) | DEV/UAT/PROD API monitors run hourly from the docs server; PROD alerts are kept off (RVQ-150) | CONFIRMED |
| Log retention | CloudWatch Logs | 114 groups, 98 never expire, about 31 GB stored; no export or backup found | CONFIRMED |
| Secrets | Secrets Manager | 16 secrets, kept only in this account; rotation status in internal evidence | CONFIRMED |
| Certificate renewal | ACM + Cloudflare | 2 of 4 ACM certificates eligible for managed renewal; earliest in-use expiry 2026-08-04; edge certificates are managed by Cloudflare | CONFIRMED |
Backups and RTO/RPO
- Approved targets
- Not recorded
- Capability from evidence
- Native database: restore to any point in about the last 3 days (3-day backup retention) CONFIRMED
- Legacy MySQL: restore to any point in the last 1 day(s); older only from manual snapshots CONFIRMED
- Document database host: no restore point unless an EBS snapshot exists CONFIRMED
- Patient documents: earlier object versions where versioning is on; no second copy CONFIRMED
- Users: no restore possible; users re-created through migration or password reset CONFIRMED
- Time to restore: UNKNOWN: never measured (no restore test) UNKNOWN
- Proposed targets
- ______ (for Farhan to approve)
- Last restore test
- date ______ · environment ______ · result ______ (none recorded)
What is backed up
| Component | Region | How | Point-in-time | Encryption | Copies elsewhere | Last backup | Protection / notes | Status |
|---|---|---|---|---|---|---|---|---|
| Native relational database (Aurora PostgreSQL) | us-east-1 | automated backups, 3 days; 9 manual snapshots | point-in-time restore window about 3.3 days; latest restorable point 2 min behind the read | encrypted, customer-managed key | no cross-region or cross-account copy found | 2026-10-30 | deletion protection OFF; single-AZ (no reader) | CONFIRMED |
| Legacy MySQL database | us-east-2 | automated backups, 1 day(s); 3 manual snapshots | point-in-time restore window 1 day(s); latest restorable point 7 min behind the read | NOT encrypted (snapshots also unencrypted) | no cross-region copy (automated-backup replication off) | 2026-10-30 | deletion protection OFF; single-AZ | CONFIRMED |
| Self-managed document database (EC2 host) | us-east-2 | NO backup found (no AWS Backup plan, no EBS snapshot) | none (disk-level backups only) | 1 of 1 disks encrypted | none found | none | single host; no replica | CONFIRMED |
| Patient-documents / uploads bucket (by name) | both | versioning on 3 of 4 | previous object versions only where versioning is on | 1 of 4 with a customer key, rest SSE-S3 | replication on 0 of 4 | not applicable (no backup job) | no second copy | CONFIRMED |
| DynamoDB tables | both | point-in-time recovery on 0 of 4 | 35 days where enabled (service default) | encrypted (service default) | none found | no on-demand backups | deletion protection on 0 | CONFIRMED |
| User accounts (Cognito) | both | NO backup: Cognito has no export of password hashes | none | service-managed | none | none | 1 of 7 pools have deletion protection; 1 use a migration trigger | CONFIRMED |
| Secrets and parameters | both | kept only in this account (no replica regions, no export) | previous secret version only | KMS | none | none | values must be re-created from a secure store outside AWS; that store is UNKNOWN | CONFIRMED |
| Legacy function code | us-east-2 | copies in source control (local copies seen); deployed packages live only in the account | none | - | UNKNOWN | - | retired runtimes: dotnet6 (5), nodejs18.x (5) cannot be created again as they are | CONFIRMED |
| Legacy API definition (API Gateway) | us-east-2 | kept only in the account; no export found | stage can point to an earlier deployment | - | none | - | 574 resources, close to the 600 quota | CONFIRMED |
| Native infrastructure + code | us-east-1 | CDK code and application code in GitHub | git history | - | GitHub | - | best-covered component: can be redeployed from source | DERIVED |
| Container images | us-east-1 | ECR only (208 images, lifecycle policy on 1 of 3) | - | ECR default | no replication | 2026-10-16 | can be rebuilt from GitHub | CONFIRMED |
| Encryption keys (KMS) | both | 5 customer keys, single-region (0 multi-region) | - | - | none (keys cannot be exported) | - | app-level field encryption in the native API uses KMS: data copied elsewhere stays unreadable without this key | CONFIRMED |
| Edge configuration (Cloudflare) | global | Worker code in GitHub (wrangler config); DNS records only in Cloudflare | Worker versions kept by Cloudflare | - | no DNS export found | - | shared zone with 31 records | DERIVED |
| Logs | both | CloudWatch Logs only; no export | - | service-managed | none | - | 98 groups never expire | CONFIRMED |
Who can restore: anyone holding restore permissions in the account; the IAM detail was not analysed (UNKNOWN).
Restore order (same or new region)
Account, access and keys
- Services
- IAM, IAM Identity Center/roles, KMS
- Source of truth
- manual + Terraform kit (iam-roles, kms)
- Approves
- Farhan Chaudry (to confirm)
- Verify
- deploy role can be assumed from GitHub; keys enabled
- Unknown
- break-glass access owner; whether the old key is still usable
Network
- Services
- VPC, subnets, route tables, NAT, security groups, VPC endpoints
- Source of truth
- CDK (native) / Terraform kit (network)
- Approves
- Farhan Chaudry (to confirm)
- Verify
- private subnets reach AWS APIs; database ports reachable from application tasks only
- Unknown
- legacy network not in any code
Data
- Services
- Aurora (snapshot or point-in-time), RDS MySQL (snapshot), EC2 document-DB host (backup), S3 data, Secrets Manager (values re-entered)
- Source of truth
- snapshots / recovery points / secure store
- Approves
- Farhan Chaudry (to confirm)
- Verify
- row counts and a sample read by the app team; secrets present (names only)
- Unknown
- secure store for secret values; consistency between the three databases
Registry
- Services
- ECR
- Source of truth
- GitHub (rebuild) or existing images
- Approves
- release owner
- Verify
- image digest matches the release
- Unknown
- -
Compute
- Services
- ECS services, Lambda (native + legacy), API Gateway (import + stage deploy), Cognito
- Source of truth
- CDK for native; legacy functions and API: Terraform kit + exported definition
- Approves
- Farhan Chaudry (to confirm)
- Verify
- services healthy; API stage answers; sign-in works for a test user
- Unknown
- legacy function packages and API export not yet produced
Edge
- Services
- ACM certificates, Cloudflare DNS and Worker routes
- Source of truth
- Terraform kit (cloudflare) / wrangler
- Approves
- Farhan Chaudry (to confirm)
- Verify
- TLS valid; DNS answers the new origin
- Unknown
- DNS export does not exist yet
CI/CD re-pointed
- Services
- GitHub environments, OIDC role, repository variables
- Source of truth
- GitHub settings
- Approves
- repository admin
- Verify
- a no-op deploy succeeds
- Unknown
- environment reviewers
Validation
- Services
- smoke tests, DEV/UAT/PROD API monitors, CloudWatch alarms
- Source of truth
- monitor + runbooks
- Approves
- Farhan Chaudry (to confirm)
- Verify
- monitors green for one full hour; no new errors
- Unknown
- no written smoke-test list
Cutover and rollback
- Services
- Cloudflare DNS (low TTL), status note
- Source of truth
- runbook
- Approves
- Farhan Chaudry (to confirm)
- Verify
- traffic on the new stack; old stack kept untouched until sign-off
- Unknown
- maintenance-window rules
Move to another AWS account
Prerequisites
- Target account inside the AWS Organization (landing zone, SCPs, budgets)
- BAA coverage for PHI in the target account via AWS Artifact: verify
- Decide region(s) and who owns the account
Access
- IAM Identity Center users/roles
- Break-glass role
- Role-based, short-lived credentials only
Keys
- Create customer-managed KMS keys
- Grant the target account use of the SOURCE keys for snapshot copy
- Snapshots encrypted with the AWS default key cannot be shared: copy them with a customer key first
Terraform state
- State bucket (versioned, encrypted, private) and lock
- Fill the private tfvars
Network
- Apply the network module
- Recreate security groups from the approved design (database ports from application tasks only)
Data
- Aurora: share snapshot -> copy -> restore (or AWS Backup cross-account copy)
- Legacy MySQL: database-level migration (dump/restore or DMS); encrypt it on the way (an unencrypted snapshot cannot become encrypted in place)
- Document-DB host: restore from backup or database dump
- S3: replication or batch copy; keep versions where needed
- Secrets: re-created out-of-band by an approved person
- Cognito: new pool with the user-migration trigger, or password reset for every user (password hashes cannot be exported)
Compute
- Native: cdk deploy into the new account
- ECR: replicate or re-push images
- Legacy Lambda: deploy packages from CI (move retired runtimes first)
- API Gateway: export -> import -> stage deploy -> custom domain + ACM certificate
CI/CD
- GitHub OIDC provider and deploy role in the new account
- Update repository variables per environment
Edge cutover
- Lower DNS TTL in advance
- Switch Cloudflare records to the new origins
- Watch monitors and alarms
Parallel run and decommission
- Run both for an agreed period
- Old account untouched until sign-off
- Decommission after data-retention rules are met
Rollback
- Point DNS back to the old origins
- Data written in the new account during the run must be reconciled: plan needed
Move to GCP (and Azure equivalents)
| AWS today | GCP | Azure |
|---|---|---|
| ECS on Fargate | Cloud Run (or GKE) | Container Apps (or AKS) |
| ALB + WAF | Cloud Load Balancing + Cloud Armor | Application Gateway + WAF / Front Door |
| Aurora PostgreSQL | Cloud SQL for PostgreSQL / AlloyDB (Database Migration Service) | Azure Database for PostgreSQL (DMS) |
| RDS MySQL | Cloud SQL for MySQL (Database Migration Service) | Azure Database for MySQL |
| MongoDB on EC2 | MongoDB on Compute Engine or a managed MongoDB service | Cosmos DB for MongoDB or a VM |
| Lambda | Cloud Run functions | Azure Functions |
| API Gateway (REST) | API Gateway / Apigee | API Management |
| Cognito | Identity Platform | Entra External ID |
| SQS / SNS / EventBridge | Pub/Sub + Cloud Scheduler / Eventarc | Service Bus / Event Grid + timers |
| S3 | Cloud Storage (Storage Transfer Service) | Blob Storage (AzCopy / Storage Mover) |
| DynamoDB | Firestore / Bigtable | Cosmos DB |
| KMS | Cloud KMS | Key Vault |
| Secrets Manager / SSM | Secret Manager | Key Vault |
| ECR | Artifact Registry | Container Registry |
| CloudWatch | Cloud Logging / Monitoring | Azure Monitor |
| CloudTrail | Cloud Audit Logs | Activity Log |
| ACM | Certificate Manager (managed certificates) | managed certificates |
| IAM + GitHub OIDC | IAM + Workload Identity Federation | Entra ID + workload identity federation |
| SES | third-party e-mail service (no direct equivalent) | Azure Communication Services Email |
Step order
- Sign a BAA with the new provider before any PHI moves (verify)
- Reassess PCI scope for the payments service (verify)
- Landing zone: organisation, projects per environment, IAM, budgets
- Network and private service access
- Keys and secrets (re-created; nothing is exported from AWS KMS)
- Databases via Database Migration Service, with a rehearsal
- Storage via Storage Transfer Service
- Rebuild containers to Artifact Registry; deploy to Cloud Run
- Replace Cognito (Identity Platform; users re-verified or reset)
- Port the legacy functions or retire them
- Cloudflare DNS cutover with low TTL
- Parallel run, sign-off, then decommission AWS
Code-change and compliance risks
| Risk | Detail | Effort | Status |
|---|---|---|---|
| Native code calls AWS directly | AWS SDK clients for Lambda (calls into the legacy functions), STS, Secrets Manager, Cognito, S3, KMS, SQS, SES, ECS and DynamoDB appear in the API code | medium-high (estimate) | DERIVED |
| App-level field encryption with KMS | clinical text is encrypted with KMS by the application; it cannot move without decrypting and re-encrypting, or keeping access to the old key | high (estimate) | DERIVED |
| Legacy functions are Lambda-shaped | 71 functions with Lambda and API Gateway event formats, mixed runtimes (.NET, Node.js, Python) | high (estimate) | CONFIRMED |
| Three databases | Aurora PostgreSQL, legacy MySQL and a self-managed document database must stay consistent during a move | high (estimate) | CONFIRMED |
| Users | password hashes cannot leave Cognito; every user re-authenticates | medium (estimate) | CONFIRMED |
| Compliance | HIPAA BAA and PCI scope must be confirmed before any data moves | verify | UNKNOWN |
Effort figures are estimates. Compliance items are marked to verify.
Terraform kit (draft recreate-kit)
Files
| File or folder | Purpose |
|---|---|
| terraform/README.md | purpose, run order, what is not covered |
| terraform/IMPORT-NOTES.md | what cannot be exported and the import/recreate order |
| modules/network | VPC, public/private subnets, NAT, routes, S3 endpoint |
| modules/alb | load balancer, HTTPS listener, redirect, target group, optional WAF |
| modules/ecs-service | Fargate service + task definition, circuit-breaker rollback, autoscaling |
| modules/ecr | repositories, scan on push, lifecycle, optional replication |
| modules/rds | Aurora PostgreSQL (snapshot / point-in-time restore inputs) and optional legacy MySQL |
| modules/lambda-functions | many functions from one map (for_each), code from CI-built packages |
| modules/api-gateway-rest | REST API from an OpenAPI export, stage, domain, optional WAF |
| modules/cognito | user pool with migration trigger |
| modules/sqs-sns | queues with dead-letter queues, topics |
| modules/s3-buckets | private, encrypted, versioned buckets |
| modules/kms | customer keys with rotation, optional cross-account use |
| modules/iam-roles | GitHub OIDC provider and deploy role, ECS roles |
| modules/cloudwatch-alarms | alarms from a map (actions off by default) |
| modules/secrets | empty secret shells, no values |
| modules/cloudflare | DNS records and Worker routes |
| envs/dev/main.tf | wires the modules for this environment |
| envs/dev/variables.tf | inputs |
| envs/dev/backend.tf.example | remote state template |
| envs/dev/terraform.tfvars.example | placeholders only |
Run order
- Create the state bucket and lock in the target account
- Copy the examples in a private working copy; fill the tfvars
- kms -> network -> rds / s3-buckets / secrets / sqs-sns
- ecr -> iam-roles -> alb -> ecs-service
- lambda-functions -> api-gateway-rest -> cognito
- cloudflare (last; this is the cutover)
- cloudwatch-alarms; then the validation step of the restore order
Validation: terraform fmt -check and terraform validate (init without a backend) passed for DEV, UAT and PROD on 2026-10-30 with Terraform 1.17.1. Never planned or applied; no state.
Placeholders only. Never planned or applied; no state. Real values are kept privately and are not linked from here.
Gaps and decisions for Farhan
| Gap | Detail | Severity | Status |
|---|---|---|---|
| No restore test recorded | no AWS Backup restore job and no restore-test record in any evidence | high | CONFIRMED |
| No approved RTO/RPO | no source shows approved targets | high | CONFIRMED |
| Legacy MySQL database | not encrypted (blocks cross-account copies), no deletion protection, single-AZ, 1-day backup window | high | CONFIRMED |
| Native database | no deletion protection, single-AZ | medium | CONFIRMED |
| Document database host has no backup | no AWS Backup plan and no disk snapshot | high | CONFIRMED |
| No copy outside the account | no cross-region or cross-account copy of databases, buckets, images or secrets | high | CONFIRMED |
| Users cannot be restored | Cognito has no backup; recovery is migration or reset | medium | CONFIRMED |
| Secrets only in the account | values must be re-created; the secure store is UNKNOWN | high | UNKNOWN |
| Legacy API definition only in the account | no export; near its resource quota | medium | CONFIRMED |
| Legacy deploy step unknown | function packages and their deploy step not found | medium | UNKNOWN |
| Retired Lambda runtimes | dotnet6 (5), nodejs18.x (5); cannot be re-created as they are in a new account or region | medium | CONFIRMED |
| Migration rollback not defined | database migrations run on deploy with no down path | medium | DERIVED |
Decisions needed
- Approve RTO and RPO targets per component (or say none yet)
- Schedule the first restore test (environment, component, owner)
- Choose the secure store for secret values
- Confirm the target for a move (another AWS account, GCP or none) and the region
- Decide hosting of this page behind the client-side gate
- Owners for the legacy MySQL, the document database host and the legacy functions
Generated from the sanitised model for RVQ-306. Identifiers, names, addresses and secrets are excluded by design and by a build-time scan.