GeoLocation

class aws_cdk.aws_route53.GeoLocation(*args: Any, **kwargs)

Bases: object

Routing based on geographical location.

ExampleMetadata:

infused

Example:

# my_zone: route53.HostedZone


# continent
route53.ARecord(self, "ARecordGeoLocationContinent",
    zone=my_zone,
    target=route53.RecordTarget.from_ip_addresses("1.2.3.0", "5.6.7.0"),
    geo_location=route53.GeoLocation.continent(route53.Continent.EUROPE)
)

# country
route53.ARecord(self, "ARecordGeoLocationCountry",
    zone=my_zone,
    target=route53.RecordTarget.from_ip_addresses("1.2.3.1", "5.6.7.1"),
    geo_location=route53.GeoLocation.country("DE")
)

# subdivision
route53.ARecord(self, "ARecordGeoLocationSubDividion",
    zone=my_zone,
    target=route53.RecordTarget.from_ip_addresses("1.2.3.2", "5.6.7.2"),
    geo_location=route53.GeoLocation.subdivision("WA")
)

# default (wildcard record if no specific record is found)
route53.ARecord(self, "ARecordGeoLocationDefault",
    zone=my_zone,
    target=route53.RecordTarget.from_ip_addresses("1.2.3.3", "5.6.7.3"),
    geo_location=route53.GeoLocation.default()
)

Attributes

continent_code
country_code
subdivision_code

Static Methods

classmethod continent(continent_code)

Geolocation resource record based on continent code.

Parameters:

continent_code (Continent) – Continent.

Return type:

GeoLocation

Returns:

Continent-based geolocation record

classmethod country(country_code)

Geolocation resource record based on country code.

Parameters:

country_code (str) – Two-letter, uppercase country code for the country. See ISO 3166-1-alpha-2 code on the International Organization for Standardization website

Return type:

GeoLocation

Returns:

Country-based geolocation record

See:

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

classmethod default()

Default (wildcard) routing record if no specific geolocation record is found.

Return type:

GeoLocation

Returns:

Wildcard routing record

classmethod subdivision(subdivision_code, country_code=None)

Geolocation resource record based on subdivision code (e.g. state of the United States).

Parameters:
  • subdivision_code (str) – Code of the subdivision (e.g. state of the United States).

  • country_code (Optional[str]) – Country code (ISO 3166-1-alpha-2) of this record, by default US (United States).

See:

https://docs.aws.amazon.com/Route53/latest/APIReference/API_GeoLocation.html#Route53-Type-GeoLocation-SubdivisionCode

Return type:

GeoLocation