Commit 8be219a
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
File tree
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-route53/test
- integ.route53.js.snapshot
- aws-cdk-lib
- aws-route53
- lib
- test
20 files changed
+1957
-1139
lines changedLines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 56 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
12 | 32 | | |
13 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
14 | 39 | | |
15 | 40 | | |
16 | 41 | | |
| |||
30 | 55 | | |
31 | 56 | | |
32 | 57 | | |
33 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
34 | 88 | | |
35 | 89 | | |
36 | 90 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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