Describe the feature
When working with constructs such as ARecord, we cannot use a weighted routing policy directly from the construct props. Instead, we have to do something hacky like this:
const aRecord = new ARecord(this, 'RecordSet', {
target: RecordTarget.fromAlias(new ApiGatewayDomain(domain)),
zone: hostedZone,
})
const recordSet = aRecord.node.defaultChild as CfnRecordSet
recordSet.weight = 100
recordSet.setIdentifier = 'API-Gateway-A-Record-whatever'
It'd be nice for there to be some sort of solution here that doesn't involve downcasting and knowledge of the guts of this construct to properly hack around.
Use Case
Weighted records of all types for route 53.
Proposed Solution
Not sure how useful this will be for someone who's actually going to do the work...
Since routing policies are mutually exclusive, perhaps some tagged union magic on a new "routing" field would help. For example:
(basically implement these routing policies from AWS' docs)
interface SimpleRoutingPolicy { }
interface WeightedRoutingPolicy {
// Something between 0-255, per R53 spec
weight: number
// The other required and optional fields that I CBA to enumerate
...
}
interface ADifferentRoutingPolicy {
...
}
type Route53RoutingPolicy = SimpleRoutingPolicy | WeightedRoutingPolicy | ADifferentRoutingPolicy
// stealing from https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.CnameRecordProps.html
interface CnameRecordProps {
// Stuff that's already there, and should stay
domainName: string
zone: IHostedZone
comment?: string
deleteExisting?: boolean
recordName?: string
ttl?: Duration
// Move to a GeoLocationRoutingPolicy interface, add that to Route53RoutingPolicy
geoLocation?: GeoLocation
// the new "routingPolicy" field
routingPolicy: Route53RoutingPolicy
}
Other Information
No response
Acknowledgements
CDK version used
2, TypeScript
Environment details (OS name and version, etc.)
AL2 on x86
Describe the feature
When working with constructs such as
ARecord, we cannot use a weighted routing policy directly from the construct props. Instead, we have to do something hacky like this:It'd be nice for there to be some sort of solution here that doesn't involve downcasting and knowledge of the guts of this construct to properly hack around.
Use Case
Weighted records of all types for route 53.
Proposed Solution
Not sure how useful this will be for someone who's actually going to do the work...
Since routing policies are mutually exclusive, perhaps some tagged union magic on a new "routing" field would help. For example:
(basically implement these routing policies from AWS' docs)
Other Information
No response
Acknowledgements
CDK version used
2, TypeScript
Environment details (OS name and version, etc.)
AL2 on x86