AWS Cloudfront:凭证应限定为有效区域 [英] AWS Cloudfront: Credential should be scoped to a valid region
问题描述
当通过 API 连接到 AWS CloudFront 时,无论我做什么,我都会收到异常:
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
相同的凭据适用于帐户具有权限的任何其他请求,例如 S3.
The same credentials work on any other request the account has permissions for, like S3.
推荐答案
该异常是由使用除us-east-1"以外的任何区域集访问 CloudFront 引起的.由于 CloudFront 基本上是无区域的,因此它要求您仅使用默认区域us-east-1"与之对话.
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
您可以使用在其他地方使用的相同凭据来解决此问题,但在显式设置区域的情况下实例化 CloudFront 客户端:
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);
接下来的问题是:为什么 API 不只是为你做这些?
Which does beg the follow-on question: Why does the API not just do this for you?
问题已发布.https://github.com/aws/aws-sdk-net/issues/115
这篇关于AWS Cloudfront:凭证应限定为有效区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!