AWS Cloudfront:凭据应限定为有效区域(AWS Cloudfront: Credential should be scoped to a valid region)

编程入门 行业动态 更新时间:2024-10-22 18:41:25
AWS Cloudfront:凭据应限定为有效区域(AWS Cloudfront: Credential should be scoped to a valid region)

通过API连接到AWS CloudFront时,无论我做什么,我都会得到异常:

Credential should be scoped to a valid region

相同的凭据适用于帐户具有权限的任何其他请求,例如S3。

When connecting to AWS CloudFront via the API, no matter what I do, I get the Exception:

Credential should be scoped to a valid region

The same credentials work on any other request the account has permissions for, like S3.

最满意答案

Exception是由使用“us-east-1”以外的任何Region设置访问CloudFront引起的。 由于CloudFront基本上是无区域的,因此它要求您仅使用默认区域“us-east-1”与其进行通信。

http://docs.aws.amazon.com/general/latest/gr/signature-v4-troubleshooting.html

您可以使用您在其他地方使用的相同凭据来解决此问题,但在明确设置了Region的情况下实例化CloudFront客户端:

AmazonCloudFrontClient client = new AmazonCloudFrontClient(Amazon.RegionEndpoint.USEast1);

请问后续问题:为什么API不仅适用于您?

编辑:发布的问题。 https://github.com/aws/aws-sdk-net/issues/115

The Exception is caused by accessing CloudFront with any Region set other than "us-east-1". Because CloudFront is basically regionless, it requires you to use only the default region "us-east-1" to talk to it.

http://docs.aws.amazon.com/general/latest/gr/signature-v4-troubleshooting.html

You can workaround this by using the same credentials you use elsewhere but instantiate the CloudFront client with the Region explicitly set:

AmazonCloudFrontClient client = new AmazonCloudFrontClient(Amazon.RegionEndpoint.USEast1);

Which does beg the follow-on question: Why does the API not just do this for you?

Edit: Issue posted. https://github.com/aws/aws-sdk-net/issues/115

更多推荐

本文发布于:2023-08-07 16:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465079.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:凭据   区域   Cloudfront   AWS   region

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!