AWS使用API​​ Gateway访问S3文件

时间:2018-11-29 07:16:13

标签: amazon-web-services amazon-s3 aws-api-gateway

我已经使用指南设置了API网关(GET和PUT)以访问S3文件 AWS API Guide。两者都在工作。

现在,我已在API网关级别启用了授权。 GET方法正在使用AWS_IAM授权,但是PUT抛出错误。

The request signature we calculated does not match the signature you provided

访问键具有将对象放入存储桶的权限。

我正在Postman v6.5.3

中尝试此操作

请求:

Header:

PUT /stage/partner/v1/document/test/image5.jpg HTTP/1.1
Host: xxxxxx.execute-api.us-east-1.amazonaws.com
docTypeCode: MISC1
Content-Type: image/jpeg
docPassword: 12345
Host: xxxxxx.execute-api.us-east-1.amazonaws.com
X-Amz-Date: 20181129T083459Z
Authorization: AWS4-HMAC-SHA256 Credential=XXXXXXXX/20181129/us-east-1/execute-api/aws4_request, SignedHeaders=cache-control;content-type;docpassword;doctypecode;host;postman-token;x-amz-date, Signature=9678befe7a0d7b8911c7c4409c2bf5ad22648bdb0665c87c1caf36f0f2c9457d
cache-control: no-cache
Postman-Token: 6cb6fd2d-5f88-4823-80ef-e021c4a520e5

Body: Binary data

响应:

Header:

Connection: keep-alive
Content-Length: 864
Content-Type: application/json
Date: Thu, 29 Nov 2018 08:30:05 GMT
Via: 1.1 5fc4d4c38db530784c809d42d6ac012c.cloudfront.net (CloudFront)
X-Amz-Cf-Id: MgjnXw3i46IvV6-CarQ719f1qSSuXnMnE74QZ6mcycE77uqryaLNqw==
X-Cache: Error from cloudfront
x-amz-apigw-id: RHZ-CG63IAMF84Q=
x-amzn-ErrorType: InvalidSignatureException

Body: {
"message": "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been\n'PUT\n/stage/partner/v1/document/test/image5.jpg\n\ncache-control:no-cache\ncontent-type:image/jpeg\ndocpassword:12345\ndoctypecode:MISC1\nhost:xxxxxx.execute-api.us-east-1.amazonaws.com\npostman-token:44aa6820-71ff-4494-8e60-38e8303746eb\nx-amz-date:20181129T083459Z\n\ncache-control;content-type;docpassword;doctypecode;host;postman-token;x-amz-date\neef327a36614081b0a9c1b81c753857697b3a4c9685f63cff7d12e2c65af5e64'\n\nThe String-to-Sign should have been\n'AWS4-HMAC-SHA256\n20181129T083459Z\n20181129/us-east-1/execute-api/aws4_request\n736b06d122eb59665699825f4aad2c23d02548c961579b2aeaebb03f0842c76b'\n"
}

0 个答案:

没有答案