Skip to content

DNS cutover: point api.fieldsofthe.world to prod, add api.dev.fieldsofthe.world #40

Description

@asmithml

Part of #33

Depends on: Deploy production infrastructure, Migrate DynamoDB data

Context

Currently api.fieldsofthe.world points to the dev CloudFront distribution (E1T5CMVYRBZH5U). After prod is deployed and data is migrated, DNS needs to switch so:

  • api.fieldsofthe.world points to the new prod CloudFront distribution
  • api.dev.fieldsofthe.world points to the existing dev CloudFront distribution

The Route53 hosted zone Z0262614UNLFJ5R8CSIF for api.fieldsofthe.world will be managed by the prod environment after the certificate-manager refactor.

Steps

  1. Communicate maintenance window to users. DNS propagation is fast (CloudFront alias records) but the cert/domain swap may cause brief downtime.

  2. Remove the custom domain from the dev environment:

    • Update environments/dev/terraform.tfvars: set custom_domain_name = "" temporarily
    • Run terraform apply in environments/dev/
    • This releases the api.fieldsofthe.world domain from the dev API Gateway and CloudFront
  3. Apply prod environment (if not already done) which claims api.fieldsofthe.world:

    • Prod creates the Route53 zone and A record pointing to its CloudFront
    • Prod creates ACM certs and API Gateway custom domain for api.fieldsofthe.world
  4. Update dev to use the new subdomain:

    • Update environments/dev/terraform.tfvars: set custom_domain_name = "api.dev.fieldsofthe.world"
    • Pass the prod-managed Route53 zone ID to the dev certificate-manager module
    • Run terraform apply in environments/dev/
    • This creates a new ACM cert for api.dev.fieldsofthe.world and adds the DNS record to the shared zone
  5. Verify both endpoints:

    • curl https://api.fieldsofthe.world/v1/ returns the prod API
    • curl https://api.dev.fieldsofthe.world/v1/ returns the dev API

Risk

  • Brief downtime on api.fieldsofthe.world during the domain swap (between steps 2 and 3)
  • If ACM certificate validation takes time, the new cert must be validated before the domain works
  • Rollback: re-apply dev with the original custom_domain_name to restore the previous state

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions