Skip to content

feat: implement AppSync custom domain support#38

Merged
takaokouji merged 4 commits intomainfrom
feature/appsync-custom-domain
Jan 10, 2026
Merged

feat: implement AppSync custom domain support#38
takaokouji merged 4 commits intomainfrom
feature/appsync-custom-domain

Conversation

@takaokouji
Copy link
Contributor

@takaokouji takaokouji commented Jan 10, 2026

This PR implements custom domain support for the AppSync GraphQL API, addressing review feedback.

Changes:

  • L2 Constructs: Switched from L1 (CfnDomainName) to L2 (GraphqlApi.domainName) property for better integration and adherence to CDK best practices.
  • Environment Variables: Added support for APPSYNC_CUSTOM_DOMAIN and ROUTE53_PARENT_ZONE_NAME to configure the domain settings without hardcoding.
  • Updated Domain Naming:
    • Production: graphql.api.smalruby.app
    • Staging: stg.graphql.api.smalruby.app
    • Parent Zone: api.smalruby.app (default)
  • Optional Configuration: The custom domain is only configured if APPSYNC_CUSTOM_DOMAIN is provided (or if a stage is detected to use the default naming).
  • Route53 Alias: Used ARecord with AppSyncTarget for the custom domain.
  • Documentation: Updated .env.example with the new variables.

Verification:

  • npm run build passes
  • npm test passes
  • Verified L2 construct support in aws-cdk-lib

Related to: smalruby/smalruby3-develop#10

- Added Route53 Hosted Zone lookup for smalruby.app
- Added ACM certificate creation with DNS validation
- Configured AppSync custom domain (CfnDomainName)
- Added AppSync domain name association
- Added Route53 CNAME record for graphql.smalruby.app
- Added CustomDomainUrl output
- Enabled env in cdk app for context lookups

Related to: smalruby/smalruby3-develop#10
- Use L2 construct (GraphqlApi.domainName property) instead of L1
- Use environment variables APPSYNC_CUSTOM_DOMAIN and ROUTE53_PARENT_ZONE_NAME
- Update domain naming to match Issue #10 requirements
- Make custom domain configuration optional
- Use Route53 Alias record with AppSyncTarget
- Update .env.example with new variables
…logic

- Corrected ARecord recordName to use relative subdomain instead of FQDN
- Simplified custom domain optionality logic and allowed disabling via APPSYNC_CUSTOM_DOMAIN=false
- Update AppSyncSubscriptionHelper to correctly construct WebSocket URLs for custom domains
- Append /realtime to custom domain WebSocket endpoints
- Use DnsValidatedCertificate for cross-region certificate support
- Skip Route53 lookup in CI by setting APPSYNC_CUSTOM_DOMAIN=false in ci.yml
- Update manual WebSocket testing guide to use correct /realtime path
@takaokouji takaokouji merged commit 9818fca into main Jan 10, 2026
3 checks passed
@takaokouji takaokouji deleted the feature/appsync-custom-domain branch January 10, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant