日: 2019年6月12日

  • User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:

    User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:

    はじめに

    API gatewayのテストをしていると、

    “` User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api: “` というエラーが出た。

    原因

    パーミッションエラー

    対処

    API gatewayの許可IPを確認する。

    aws:SourceIpにIPを追加する。

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Principal": "*",
                "Action": "execute-api:Invoke",
                "Resource": "arn:aws:execute-api:*:*:*/*",
                "Condition": {
                    "IpAddress": {
                        "aws:SourceIp": [
                            "123.0.0.1",
                            "1.23.4.1"
                        ]
                    }
                }
            }
        ]
    }

     

    参考情報

    クラメソさん、いつもありがとうございます。

    https://dev.classmethod.jp/cloud/aws/api-gateway-resource-policy/