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
-
Communicate maintenance window to users. DNS propagation is fast (CloudFront alias records) but the cert/domain swap may cause brief downtime.
-
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
-
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
-
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
-
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
Part of #33
Depends on: Deploy production infrastructure, Migrate DynamoDB data
Context
Currently
api.fieldsofthe.worldpoints to the dev CloudFront distribution (E1T5CMVYRBZH5U). After prod is deployed and data is migrated, DNS needs to switch so:api.fieldsofthe.worldpoints to the new prod CloudFront distributionapi.dev.fieldsofthe.worldpoints to the existing dev CloudFront distributionThe Route53 hosted zone
Z0262614UNLFJ5R8CSIFforapi.fieldsofthe.worldwill be managed by the prod environment after the certificate-manager refactor.Steps
Communicate maintenance window to users. DNS propagation is fast (CloudFront alias records) but the cert/domain swap may cause brief downtime.
Remove the custom domain from the dev environment:
environments/dev/terraform.tfvars: setcustom_domain_name = ""temporarilyterraform applyinenvironments/dev/api.fieldsofthe.worlddomain from the dev API Gateway and CloudFrontApply prod environment (if not already done) which claims
api.fieldsofthe.world:api.fieldsofthe.worldUpdate dev to use the new subdomain:
environments/dev/terraform.tfvars: setcustom_domain_name = "api.dev.fieldsofthe.world"terraform applyinenvironments/dev/api.dev.fieldsofthe.worldand adds the DNS record to the shared zoneVerify both endpoints:
curl https://api.fieldsofthe.world/v1/returns the prod APIcurl https://api.dev.fieldsofthe.world/v1/returns the dev APIRisk
api.fieldsofthe.worldduring the domain swap (between steps 2 and 3)custom_domain_nameto restore the previous state