Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

MIGRATION ISSUE: No programatic access to region descriptions used in pricing API #739

@rifelpet

Description

@rifelpet

Pre-Migration Checklist

Go Version Used

Go 1.22

Describe the Migration Issue

The pricing.GetProducts API Action supports filtering on arbitrary product metadata. The example output in the AWS CLI docs shows a response with fields:

"locationType":"AWS Region","location":"Asia Pacific (Singapore)"

Note that the location value is not the region name ap-southeast-1 but a region description Asia Pacific (Singapore) that correspond to the values in this table in the AWS docs.

In the v1 SDK this field was available through exported methods:

https://github.com/aws/aws-sdk-go/blob/417f8a94adeed59918cfef686dcb3e438b77735b/aws/endpoints/defaults.go#L179-L181

In the v2 SDK there is no such way to map a region name to a region description, including with ec2.DescribeRegions.

Code Comparison

This repo in the AWS github org demonstrates the SDK v1 usage with pricing.GetProductsInput{}:

https://github.com/aws/amazon-ec2-instance-selector/blob/14d4dfcbaadfe9a1c389c823df8eb7b142f2c997/pkg/ec2pricing/odpricing.go#L275-L297

There is no such solution for SDK v2.

Observed Differences/Errors

I would expect the SDK v2 to offer a mapping between region names and these region descriptions like Asia Pacific (Singapore) so I can filter pricing products by location. Each region's pricing API returns results for all regions, so initializing the pricing API client with a specific region is insufficient.

Additional Context

I'm aware of the desire to treat region identifiers as opaque strings, however this makes the pricing.GetProducts API very difficult to filter by region.

As mentioned in aws/amazon-ec2-instance-selector#158, this prevents the project from fully migrating off of the v1 SDK.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions