aws-sdk-rust icon indicating copy to clipboard operation
aws-sdk-rust copied to clipboard

Provide a way to get partition from region

Open MikeDombo opened this issue 2 years ago • 7 comments

Describe the feature

Other SDK languages provide rich information about their regions, and specifically what partition they are in (ie. "aws", "aws-cn", etc).

Use Case

Knowing the partition is necessary to generate correct arns and for some business logic which may differ between partitions.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

A note for the community

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue, please leave a comment

MikeDombo avatar May 24 '23 02:05 MikeDombo

interesting—can you provide some more use cases when this is required? This is something we could consider exposing, we have the logic internally but we're often hesitant to expose behavior like this because of backwards and forwards compatibility concerns.

rcoh avatar May 24 '23 12:05 rcoh

In Java, I'm using the partition information to get the dnsSuffix and using the partition id to build an arn when looking up IAM managed policies. DNSSuffix is amazonaws.com.cn for example. This is used to manually build an endpoint to allow connecting to prod/gamma endpoints in a region without fully hardcoding the endpoint URL.

MikeDombo avatar May 24 '23 13:05 MikeDombo

We do have this code internally to resolve endpoints. Wouldn't be necessarily a bad idea to expose it.

rcoh avatar Aug 08 '23 18:08 rcoh

As an example I'm running into today - when setting up a new ACM PCA, one of the fields required is the template ARN, in order to override the default template and use RootCACertificate/V1 instead.

The correct value varies based on the region per the ACM PCA docs:

arn:aws:acm-pca:::template/RootCACertificate/V1
arn:aws-us-gov:acm-pca:::template/RootCACertificate/V1
...

If I could get the partition from the region, then it would be trivial to generate the ARN, since the other fields are constant.

bcressey avatar Aug 16 '23 19:08 bcressey

Closing this for now, as this isn't something that we plan on supporting in the near future.

jmklix avatar Apr 26 '24 17:04 jmklix

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.

github-actions[bot] avatar Apr 26 '24 17:04 github-actions[bot]

Another use case requested is to build an Arn and pass Arn-valued string to create a request for assume role. Currently, the Rust SDK users build up a raw string by themserlves without being able to use something like .to_string() on Arn struct.

Related is https://github.com/smithy-lang/smithy-rs/issues/4090. When 4090 is worked on, it should be addressed along with this issue.

ysaito1001 avatar Jun 16 '25 22:06 ysaito1001