aws_route53: Allow updates to existing records in a single operation
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
Currently, in order to update a Route53 record's routing policy using CDK (which uses an underlying lambda to process events), we have to do multiple passes at a record's fields over the course of multiple deployments. This operation is supported in the console with 1 click. For example, we have to do the following:
(initial code - uses simple routing policy)
```
const aRecord = new ARecord(this, 'RecordSet', {
target: RecordTarget.fromAlias(new ApiGatewayDomain(domain)),
zone: hostedZone,
})
```
(first pass - changing routing policy to weighted)
```
// Delete this for round 2 of deployments
const aRecord = new ARecord(this, 'RecordSet', {
target: RecordTarget.fromAlias(new ApiGatewayDomain(domain)),
zone: hostedZone,
})
const aRecord2 = new ARecord(this, 'RecordSet2', {
target: RecordTarget.fromAlias(new ApiGatewayDomain(domain)),
zone: hostedZone,
deleteExisting: true, // Delete this for round 2 of deployments
})
const recordSet = aRecord2.node.defaultChild as CfnRecordSet
recordSet.weight = 100
recordSet.setIdentifier = 'API-Gateway-A-Record-weighted'
aRecord2.node.addDependency(aRecord)
```
(second pass - cleanup)
```
const aRecord2 = new ARecord(this, 'RecordSet2', {
target: RecordTarget.fromAlias(new ApiGatewayDomain(domain)),
zone: hostedZone,
})
const recordSet = aRecord2.node.defaultChild as CfnRecordSet
recordSet.weight = 100
recordSet.setIdentifier = 'API-Gateway-A-Record-weighted'
```
### Use Case
Modifying record routing policies.
### Proposed Solution
Involves updating the custom resource lambda, of which I haven't poked around in.
### Other Information
We're also required to use the `deleteExisting` field, which theoretically isn't necessary (but is super dangerous). R53 appears to allow the entire operation to be done at once (rm old, insert new) with validation at API-call-time that the new, to-be-inserted is valid _before_ deleting the old one. This means that there shouldn't be a case where the existing record is deleted and the new one cannot be inserted.
### Acknowledgements
- [ ] I may be able to implement this feature request
- [x] This feature might incur a breaking change
### CDK version used
2, TypeScript
### Environment details (OS name and version, etc.)
AL2 on x86
Contributor guide
Research direction
Start by tracing the custom resource lambda used by the Route53 ARecord construct, focusing on how it handles existing records and the deleteExisting field. Use the issue's simple-to-weighted routing-policy example as the expected behavior. Done means an existing record can be updated in one deployment without requiring deleteExisting or multiple passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100