InvalidSignatureException:Credential的范围应该是正确的服务:' lex'

时间:2017-12-28 11:54:52

标签: amazon-web-services curl aws-lambda amazon-lex

我试图通过curl调用Amazon Lex API,这样做我坚持这个错误:

<InvalidSignatureException>
  <Message>InvalidSignatureException: Credential should be scoped to correct service: 'lex'. </Message>
</InvalidSignatureException>

我的卷曲请求:

curl -X GET \
  'https://runtime.lex.us-east-1.amazonaws.com/bots/botname/versions/versionoralias' \
  -H 'authorization: AWS4-HMAC-SHA256 Credential=xxxxxxxxxxxx/20171228/us-east-1/execute-api/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=xxxxxxxxxxxxxxxx' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'x-amz-date: 20171228T114646Z'

1 个答案:

答案 0 :(得分:0)

您应该使用AWS CLI而不是cURL。将为您管理签名。尝试自己签署您的AWS电话,您将在痛苦和403错误的世界中结束。

您正在寻找的Lex API调用是here

请参阅this documentation以开始使用AWS CLI。