Skip to content
This repository has been 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

Closed
2 tasks done
rifelpet opened this issue May 6, 2024 · 6 comments
Closed
2 tasks done
Assignees
Labels
feature-request New feature or request pricing service-api This issue pertains to the AWS API

Comments

@rifelpet
Copy link

rifelpet commented May 6, 2024

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.

@RanVaknin RanVaknin self-assigned this May 6, 2024
@RanVaknin
Copy link

Hi @rifelpet ,

Thanks for reaching out. I can see how having a programmatic list of region to region description names can be handy when wanting to filter on the results of the GetProducts API. Unfortunately we cannot re-introduce this programmatic mapping for a few reasons, one of them was mentioned in my answer that you linked, and but also discussed more in here.

The real problem here is that the getProducts API should not have used a region description and instead would use the region code which is ubiquitous across all AWS service. That would circumvent the need to rely on the list of the region data in the first place.

I know that the following is not really a solution but more of a workaround. You can hand maintain the list of region to region-descriptors yourself. In terms of the API usage, if you were a direct consumer of the API you would have needed to know those region descriptors ahead of time. Not that I'm advocating for this, but if this is truly how the API was designed to work maybe it was an intentional choice from the pricing API team.

What I can do is submit an internal feature request on your behalf to the pricing service team to ask them to add another filter field regionFilter or something of that sort, that would mirror the existing location filter but instead use the actual region code.

Let me know your thoughts.
Thanks,
Ran~

@RanVaknin RanVaknin added feature-request New feature or request response-requested This issue requires a response to continue service-api This issue pertains to the AWS API p2 and removed needs-triage labels May 6, 2024
@rifelpet
Copy link
Author

rifelpet commented May 6, 2024

Hi Ran,

Thanks for the quick response. Maintaining a region to descriptor mapping ourselves is too unreasonable of a regression for me to pursue. In this case the region comes from a CLI flag so the expectation should be that our code shouldn't need to know all possible descriptor values ahead of time.

I agree that having the pricing API recognize region identifiers would be the best long term solution. Feel free to feature request and I suppose we'll keep using the v1 SDK until the pricing API fix is implemented. One additional concern here is if the v1 SDK reaches maintenance mode on July 31st 2024 and the feature request still hasn't been implemented. At that point the v1 SDK wont receive new regions, meaning we'll need to add more special casing into our pricing API calling code until the pricing API fix is implemented.

@github-actions github-actions bot removed the response-requested This issue requires a response to continue label May 7, 2024
@RanVaknin RanVaknin transferred this issue from aws/aws-sdk-go-v2 May 8, 2024
@RanVaknin
Copy link

Hi @rifelpet ,

I understand where you are coming from, and sympathetic to the need. I have created an internal feature request with the pricing service team V1378823017. I don't have visibility to when / if this would be implemented, but I will check with them periodically at least to make sure this has made it to their queue.

You can safely mix imports between v2 and v1, so if the only implementation detail holding you back from upgrading to v2 is this, you can simply import alias the package from v1 that has the region info until this is implemented.

If you have access to AWS support through the AWS developer console my advice would be to open a support ticket yourself and reference the ticket ID I shared above, that might help drive this feature forward.

All the best,
Ran~

@RanVaknin RanVaknin added pricing and removed p2 labels May 8, 2024
@amberkushwaha
Copy link

location name is also changed in the most changed regime for the particular paste drop or click to add files inot it for the section values in it.

@RanVaknin
Copy link

RanVaknin commented Oct 30, 2024

We were not able to get an acknowledgement from the service about this feature. I have created an additional ticket in a different FR pipeline internally. Please refer to the ec2 blog and check for new announcement to see if this was implemented in the future. Since it's not actionable by the SDK team Im going to go ahead an close this.

Thanks,
Ran~

@RanVaknin RanVaknin closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
Copy link

This issue is now closed.

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request New feature or request pricing service-api This issue pertains to the AWS API
Projects
None yet
Development

No branches or pull requests

3 participants