web-dev-qa-db-ja.com

AWS API Gatewayエラー:API Gatewayには、提供されたロールをS3プロキシとして引き受ける権限がありません

同様の質問がありますが、私が試した回答があります。何が間違っているのかはわかりませんが、助けていただければ幸いです。

テストの詳細: enter image description here

メソッド実行テストからのエラー。 PUTリクエスト:

Execution log for request test-request
Mon Oct 16 10:13:47 UTC 2017 : Starting execution for request: test-invoke-request
Mon Oct 16 10:13:47 UTC 2017 : HTTP Method: PUT, Resource Path: /pop-data-xmlz/test.xml
Mon Oct 16 10:13:47 UTC 2017 : Method request path: {item=test.xml, folder=pop-data-xmlz}
Mon Oct 16 10:13:47 UTC 2017 : Method request query string: {}
Mon Oct 16 10:13:47 UTC 2017 : Method request headers: {Content-Type=application/xml}
Mon Oct 16 10:13:47 UTC 2017 : Method request body before transformations: <test>
test string
</test>
Mon Oct 16 10:13:47 UTC 2017 : Request validation succeeded for content type application/json
Mon Oct 16 10:13:47 UTC 2017 : Execution failed due to configuration error: API Gateway does not have permission to assume the provided role
Mon Oct 16 10:13:47 UTC 2017 : Method completed with status: 500

API Gateway To S3チュートリアル( http://docs.aws.Amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-s3.html )に従っていますPUT要求を実行しようとしています。

API Gatewayはus-east-1にあり、S3バケットはus-east-2にあります。

作成されたロール:APIGatewayProxyCustom

S3バケットへのPUT要求を許可するポリシー(pop-date-ingest)が添付されます。 enter image description here

ロールには信頼関係が設定されています: enter image description here

19
Kurt Campher

これを修正するには、IAMのロールに移動し、「信頼関係」タブを選択します。ここからポリシーを編集し、プリンシパルサービス用に「apigateway.amazonaws.com」を以下のように追加します。これにより、既存のラムダアクセス許可に加えて、API Gatewayがロールを引き受けて機能を実行できるようになります。

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": ["apigateway.amazonaws.com","lambda.amazonaws.com"]
},
"Action": "sts:AssumeRole"
}
]
}