Я настроил 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"
}