Skip to content

Commit 8be219a

Browse files
authored
feat(route53): add SVCB and HTTPS resource record classes (#34744)
### Issue # (if applicable) Closes #34673. ### Reason for this change Route53 supports SVCB and HTTPS resource records and CDK also supports via `route53.RecordType.SVCB` and `route53.RecordType.HTTPS`. https://aws.amazon.com/about-aws/whats-new/2024/10/amazon-route-53-https-sshfp-svcb-tlsa-dns-support/ HTTPS record can be an alias to CloudFront. https://aws.amazon.com/about-aws/whats-new/2025/07/amazon-cloudfront-https-dns-records/ It's useful to make a resource class for HTTPS record like `ARecord` etc to ensure generating correct record values. Currently, most common usage is to create an HTTPS ServiceMode record with ALPN parameter. ``` ts // Before new route53.RecordSet(this, 'HttpsRecord', { zone, recordType: route53.RecordType.HTTPS, target: route53.RecordTarget.fromValues('1 . alpn="h3,h2"')], }); // After new route53.HttpsRecord(this, 'HttpsRecord', { zone, values: [route53.HttpsRecordValue.service({ alpn: [route53.Alpn.H3, route53.Alpn.H2] })], }); ``` SVCB and HTTPS have same representation format. Therefore I added both record classes to share implementation. ### Description of changes Added `SvcbRecord` and `HttpsRecord` resource classes and corresponding types. `HttpsRecord` also supports CloudFront alias target. #### Usage ``` ts declare const zone: route53.IHostedZone; declare const distribution: cloudfront.IDistribution; // AliasMode (priority = 0) new route53.HttpsRecord(this, 'HTTPS-AliasMode', { zone, values: [route53.HttpsRecordValue.alias('service.example.com')], }); // ServiceMode (priority >= 1) new route53.HttpsRecord(this, 'HTTPS-ServiceMode', { zone, values: [route53.HttpsRecordValue.service({ // All props are optional // SvcPriority - defaults to 1 priority: 1, // TargetName - defaults to '.' targetName: '.', // SvcParam mandatory: [...], alpn: [...], port: ..., ipv4hint: [...], ipv6hint: [...], }), }); // CloudFront alias target new route53.HttpsRecord(this, 'HTTPS-CloudFrontAlias', { zone, target: route53.RecordTarget.fromAlias(new route53_targets.CloudFrontTarget(distribution)), }); ``` To define SVCB record, just replace `Https` to `Svcb`. For details of each parameter, see [RFC 9460](https://www.rfc-editor.org/rfc/rfc9460.html). ### Describe any new or updated permissions being added N/A ### Description of how you validated changes Unit tests and integ test. I've confirmed Route53 rejects undefined SvcParam keys such as `key65444=ex2`. ``` console $ aws route53 change-resource-record-sets --hosted-zone-id XXXXXXXX --change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"example.com","Type":"SVCB","ResourceRecords":[{"Value":"1 . key65444=ex2"}],"TTL":1800}}]}' An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [SVCB does not support undefined parameters.] $ aws route53 change-resource-record-sets --hosted-zone-id XXXXXXXX --change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"example.com","Type":"HTTPS","ResourceRecords":[{"Value":"1 . key65444=ex2"}],"TTL":1800}}]}' An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [HTTPS does not support undefined parameters.] ``` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent ce76a56 commit 8be219a

20 files changed

+1957
-1139
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.assets.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/aws-cdk-cloudfront.template.json

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,33 @@
99
"HostedZoneAlias40D2E006": {
1010
"Type": "AWS::Route53::RecordSet",
1111
"Properties": {
12+
"AliasTarget": {
13+
"DNSName": {
14+
"Fn::GetAtt": [
15+
"MyDistributionCFDistributionDE147309",
16+
"DomainName"
17+
]
18+
},
19+
"HostedZoneId": {
20+
"Fn::FindInMap": [
21+
"AWSCloudFrontPartitionHostedZoneIdMap",
22+
{
23+
"Ref": "AWS::Partition"
24+
},
25+
"zoneId"
26+
]
27+
}
28+
},
29+
"HostedZoneId": {
30+
"Ref": "HostedZoneDB99F866"
31+
},
1232
"Name": "_foo.test.public.",
13-
"Type": "A",
33+
"Type": "A"
34+
}
35+
},
36+
"HostedZoneAaaaAliasD8DDBA5A": {
37+
"Type": "AWS::Route53::RecordSet",
38+
"Properties": {
1439
"AliasTarget": {
1540
"DNSName": {
1641
"Fn::GetAtt": [
@@ -30,7 +55,36 @@
3055
},
3156
"HostedZoneId": {
3257
"Ref": "HostedZoneDB99F866"
33-
}
58+
},
59+
"Name": "_foo.test.public.",
60+
"Type": "AAAA"
61+
}
62+
},
63+
"HostedZoneHttpsAlias0D3AF83C": {
64+
"Type": "AWS::Route53::RecordSet",
65+
"Properties": {
66+
"AliasTarget": {
67+
"DNSName": {
68+
"Fn::GetAtt": [
69+
"MyDistributionCFDistributionDE147309",
70+
"DomainName"
71+
]
72+
},
73+
"HostedZoneId": {
74+
"Fn::FindInMap": [
75+
"AWSCloudFrontPartitionHostedZoneIdMap",
76+
{
77+
"Ref": "AWS::Partition"
78+
},
79+
"zoneId"
80+
]
81+
}
82+
},
83+
"HostedZoneId": {
84+
"Ref": "HostedZoneDB99F866"
85+
},
86+
"Name": "_foo.test.public.",
87+
"Type": "HTTPS"
3488
}
3589
},
3690
"Bucket83908E77": {

packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/awscdkroute53cloudfrontaliasintegtestDefaultTestDeployAssertFC81AA74.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/awscdkroute53cloudfrontaliasintegtestDefaultTestDeployAssertFC81AA74.template.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/cdk.out

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-route53-targets/test/integ.cloudfront-alias-target.js.snapshot/integ.json

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)