bra-fsn/cloudperf

Support "sibling" zones

Opened this issue · 1 comments

Until a while I tried to add Wavelength and Local Zones to the mapping, like these:

    'US East (Verizon) - Washington DC': 'us-east-1-wl1-was1',
    'US West (Denver)': 'us-west-2-den-1',
    'US West (Los Angeles)': 'us-west-2-lax-1',
    'US West (Verizon) - Denver': 'us-west-2-wl1-den1',

but Amazon has ceased to provide this information in an easily accessible manner (from their pricing web page), so I'm dropping to support these.
Sometime in the future, if the mapping can be discovered by AWS APIs these could be added back.

Amazon recommends the following workaround until the data is available via the APIs:

As a short-term mitigation I would recommend to use the Region and RegionMetadata infrastructure from the SDKv2, see

https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/regions/Region.html
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/regions/RegionMetadata.html
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/regions/RegionMetadataProvider.html

The long region names are tracked as description in RegionMetadata classes. This can be used to build a reverse mapping from those descriptions (for instance Asia Pacific(Sydney)) to the region code (for example ap-southeast-2) using RegionMetadataProvider:

fun regionLongMapMapping(): Map<String, String> {
    val metadataProvider = GeneratedRegionMetadataProvider()
    return Region.regions()
        .mapNotNull { metadataProvider.regionMetadata(it) }
        .map { it.description() to it.id() }
        .toMap()
}