-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(route53): support geolocation routing #26383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really exciting -- it looks like this is the first complex routing supported in the L2 RecordSet construct!
I'm personally really interested in using these APIs and I have a question on the API for continents, some small docs suggestions, and a question about maybe trying to catch a failure case early (during synthesis).
* Geolocation resource record based on continent code. | ||
* @param continentCode Code of the continent. Valid codes are AF (Africa), AN (Antarctica), AS (Asia), | ||
* EU (Europe), OC (Oceania), NA (North America), SA (South America). | ||
* @returns Continent-based geolocation record | ||
*/ | ||
public static continent(continentCode: string) { | ||
return new GeoLocation(continentCode, undefined, undefined); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this has a very small list of acceptable values (and new continents are unlikely), is there value in this being an enum instead?
export enum Continent {
AFRICA = "AF",
ANTARCTICA = "AN",
ASIA = "AS",
EUROPE = "EU",
OCEANIA = "OC",
NORTH_AMERICA = "NA",
SOUTH_AMERICA = "SA"
}
That way users can do route53.GeoLocation.continent(route53.Continent.ASIA)
instead of needing to know the code (and perhaps have autocomplete/suggestions from an IDE/tool)?
It might be a bit overly verbose to do that though, especially since enums aren't really the easiest option for the remaining values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this makes sense. The enum is easier to use. It's not consistent anymore because country uses a string and continent uses an enum. However, I like the autocompletion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jumic this looks great! I left a few very minor comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jumic Looks great! Thanks for your work and contribution.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Add support for [geolocation routing](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy-geo.html) in Route53 RecordSets. This PR adds attribute `geoLocation` to `RecordSetOptions` and new class `GeoLocation`. This enables developers to use geolocation routing. The new feature can be used like this (more examples in README): ```ts new route53.ARecord(this, 'ARecordGeoLocationContinent', { zone: myZone, target: route53.RecordTarget.fromIpAddresses('1.2.3.0', '5.6.7.0'), geoLocation: route53.GeoLocation.continent('EU'), // Europe }); ``` Closes aws#9478. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Add support for geolocation routing in Route53 RecordSets.
This PR adds attribute
geoLocation
toRecordSetOptions
and new classGeoLocation
. This enables developers to use geolocation routing.The new feature can be used like this (more examples in README):
Closes #9478.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license