Skip to content
v2.274.0

GeoLocation Class ​

Routing based on geographical location.

Example ​

ts
declare const myZone: route53.HostedZone;

// continent
new route53.ARecord(this, 'ARecordGeoLocationContinent', {
  zone: myZone,
  target: route53.RecordTarget.fromIpAddresses('1.2.3.0', '5.6.7.0'),
  geoLocation: route53.GeoLocation.continent(route53.Continent.EUROPE),
});

// country
new route53.ARecord(this, 'ARecordGeoLocationCountry', {
  zone: myZone,
  target: route53.RecordTarget.fromIpAddresses('1.2.3.1', '5.6.7.1'),
  geoLocation: route53.GeoLocation.country('DE'), // Germany
});

// subdivision
new route53.ARecord(this, 'ARecordGeoLocationSubDividion', {
  zone: myZone,
  target: route53.RecordTarget.fromIpAddresses('1.2.3.2', '5.6.7.2'),
  geoLocation: route53.GeoLocation.subdivision('WA'), // Washington
});

// default (wildcard record if no specific record is found)
new route53.ARecord(this, 'ARecordGeoLocationDefault', {
  zone: myZone,
  target: route53.RecordTarget.fromIpAddresses('1.2.3.3', '5.6.7.3'),
  geoLocation: route53.GeoLocation.default(),
});

Properties ​

continentCodeContinentcontinent_codeContinentcontinentCodeContinentContinentCodeContinentContinentCodeContinent#
countryCodestringcountry_codestrcountryCodeStringCountryCodestringCountryCode*string#
subdivisionCodestringsubdivision_codestrsubdivisionCodeStringSubdivisionCodestringSubdivisionCode*string#

Methods ​

continent(continentCode: Continent): GeoLocation // chainable@staticmethod def continent(continent_code: Continent) -> GeoLocationpublic static GeoLocation continent(Continent continentCode)public static GeoLocation Continent(Continent continentCode)func Continent(ContinentCode Continent) GeoLocationstatic#
Geolocation resource record based on continent code.
1 parameter · returns

Parameters

  • continentCodecontinent_codecontinentCodecontinentCodeContinentCode — Continent.

Returns: Continent-based geolocation record

country(countryCode: string): GeoLocation // chainable@staticmethod def country(country_code: str) -> GeoLocationpublic static GeoLocation country(String countryCode)public static GeoLocation Country(string countryCode)func Country(CountryCode *string) GeoLocationstatic#
Geolocation resource record based on country code.
1 parameter · returns

Parameters

  • countryCodecountry_codecountryCodecountryCodeCountryCode — Two-letter, uppercase country code for the country.

Returns: Country-based geolocation record

default(): GeoLocation // chainable@staticmethod def default() -> GeoLocationpublic static GeoLocation default()public static GeoLocation Default()func Default() GeoLocationstatic#
Default (wildcard) routing record if no specific geolocation record is found.
returns

Returns: Wildcard routing record

subdivision(subdivisionCode: string, countryCode?: string): GeoLocation // chainable@staticmethod def subdivision(subdivision_code: str, country_code: typing.Optional[str] = None) -> GeoLocationpublic static GeoLocation subdivision(String subdivisionCode, String countryCode)public static GeoLocation Subdivision(string subdivisionCode, string? countryCode = null)func Subdivision(SubdivisionCode *string, CountryCode *string) GeoLocationstatic#
Geolocation resource record based on subdivision code (e.g. state of the United States).
2 parameters

Parameters

  • subdivisionCodesubdivision_codesubdivisionCodesubdivisionCodeSubdivisionCode — Code of the subdivision (e.g. state of the United States).
  • countryCodecountry_codecountryCodecountryCodeCountryCode — Country code (ISO 3166-1-alpha-2) of this record, by default US (United States).