通过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 regionThe 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
更多推荐
发布评论