Skip to content

Create the portable sandbox network, DNS, edge, and TLS foundation #67

Description

@alexeygrigorev

Parent epic: #9

Normative spec: 08 — AWS sandbox and Terraform
Resolved topology decision: #25

Scope

In DataTalksClub/aws-infra, create an independent sandbox/website Terraform root and reusable/portable Django website module for the first scaffold deployment at web.dtcdev.click.

  • Re-inventory the sandbox account before planning.
  • Reference delegated Route 53 hosted zone ID Z05963572WVWFHDQZH5NE explicitly.
  • Create only the web.dtcdev.click alias and certificate-validation records owned by this workload.
  • Add ACM/TLS, CloudFront, a protected ALB origin, and the routing/header hooks needed by the scaffold.
  • Create a dedicated two-AZ VPC using the accepted cost-aware sandbox topology: public ALB subnets, tightly restricted public-IP ECS task subnets without NAT, and isolated private RDS subnets.
  • Allow task ingress only from the ALB security group and PostgreSQL only from the task security group. Prevent a useful direct-origin bypass.
  • Add workload tagging, constrained Terraform/provider versions, variables/outputs, examples, backend documentation, and production-account inputs.
  • Use the sandbox bootstrap's encrypted/locked remote state with an independent key such as sandbox/website/terraform.tfstate.

Non-goals

  • No ECR, ECS services, RDS instance, application deployment, SES, S3 content assets, or feature-specific alarms; those belong to Provision the minimum HTTPS-origin scaffold runtime on ECS and RDS #68 or later domain issues.
  • No hosted-zone creation, registrar/delegation change, name-only zone lookup, default-VPC reuse, committed state/plan/backend credentials/real tfvars/secrets, or sandbox-state promotion to production.
  • No NAT gateway in the accepted sandbox profile; production inputs must still support private tasks plus NAT or VPC endpoints.

Acceptance criteria

  • A fresh AWS inventory is recorded before plan review and confirms every reused identifier.
  • Terraform uses hosted zone ID Z05963572WVWFHDQZH5NE exactly and owns only web.dtcdev.click plus required certificate-validation records.
  • The plan creates no hosted zone, delegation change, default-VPC dependency, or unrelated shared-resource mutation.
  • The independent encrypted/locked backend and state key are documented without credentials or state in Git.
  • Two availability zones, public ALB, ALB-only task ingress, isolated DB subnets, task-only PostgreSQL ingress, and origin protection match resolved Decision: Approve the cost-aware sandbox network topology #25.
  • TLS/CloudFront/ALB routing and application/edge header hooks support web.dtcdev.click without weakening the scaffold's noindex/no-store behavior.
  • Module/root inputs contain no fixed account, network, hostname, size, or retention assumptions and a production fixture can plan without sandbox state dependency.
  • terraform fmt, validate, lint/static policy checks, and reviewed sandbox plan pass; policy rejects zone creation, public database, open task ports, unencrypted state/resources, wildcard deployment permissions, and committed secrets.

Test scenarios

  1. Plan the sandbox root and review every created/changed resource against workload ownership and the exact hosted-zone ID.
  2. Negative fixtures for name-only zone lookup, a third same-name zone, open task ingress, public database subnet intent, origin bypass, unencrypted state/resource, and wildcard IAM fail policy.
  3. Plan a production-root fixture using a different account, zone, domain, subnet mode, and backend without referencing sandbox resources/state.
  4. Verify network reachability contracts: internet→CloudFront/ALB only, ALB→tasks only, tasks→RDS only, and no public task/RDS ingress.

No Playwright surface is created in this issue; deployed TLS/routing/browser verification belongs to #70.

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Must-have or release-blockinginfraArea: infrasecurityArea: security

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions