(aws-apprunner) Alias domain association via aws-certificatemanager
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Allow a custom domain to be specified using a Route53 Zone. Or, alternatively, decouple the process of creating https certificates from App Runner and lean on the existing AWS Certificate Manager validation methods.
### Use Case
Currently, it doesn't seem possible/documented to be able to associate a custom domain with an App Runner instance via the CDK at all.
There is a method offered via the API/Console, but it seems relatively manual and doesn't include any automation.
It would be preferable to set-up custom domains using a method consistent with that used by other CDK packages – such as CloudFront – which make this process especially simple.
### Proposed Solution
Decouple the process of creating https certificates from App Runner, support ALIAS records, and lean on the existing AWS Certificate Manager validation methods.
An ideal API inspired by CloudFront might look like:
// Custom domain
const apexdomain = "example.com"
const subdomain = "my-app"
const domain = `${subdomain}.${apexdomain}`
// HostedZone lookup from current AWS region and account. Requires the Hosted Zone
// to be set-up manually, and the DNS pointed at the SOA record in order for the
// DnsValidatedCertifcate's validation to succeed.
const zone = route53.HostedZone.fromLookup(this, 'HostedZone', { domainName: apexdomain })
// TLS certificate
const certificate = new route53.DnsValidatedCertificate(this, 'SiteCertificate', {
domainName: domain,
hostedZone: zone,
region: 'us-east-1', // Cloudfront only checks this region for certificates.
})
// Inspired by CloudFront ViewCertificate
const viewerCertificate = appRunner.ViewerCertificate.fromAcmCertificate(certificate, {
aliases: [domain]
})
// App Runner service definition
const service = new apprunner.Service(this, 'Service', {
source: apprunner.Source.fromGitHub({
repositoryUrl: 'https://github.com/aws-containers/hello-app-runner',
branch: 'main',
configurationSource: apprunner.ConfigurationSourceType.REPOSITORY,
connection: apprunner.GitHubConnection.fromConnectionArn('CONNECTION_ARN'),
}),
// New optional `viewerCertificate` property in
viewerCertificate: viewerCertificate
})
// Route53 alias record for the App Runner Service
new route53.ARecord(this, 'SiteAliasRecord', {
zone: zone,
recordName: domain,
target: RecordTarget.fromAlias(new route53Targets.AppRunnerTarget(service)) // new App Runner Target
})
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.19.0
### Environment details (OS name and version, etc.)
agnostic
Contributor guide
Research direction
Start with the aws-apprunner Service API and the Route53/ACM integration points shown in the proposal; compare how existing CDK packages expose certificate validation and alias targets. Define the supported certificate, hosted-zone, alias, and regional behavior, then add coverage for custom-domain creation and confirm the resulting App Runner association and Route53 record can be synthesized.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100