x-amazon-apigateway-integration获取uri属性的lambda arn

时间:2019-02-02 19:54:45

标签: amazon-web-services aws-lambda amazon-cloudformation aws-api-gateway

x-amazon-apigateway-intregration extension具有URI属性,可以取后端的ARN值。当我尝试使用SAM部署它时,出现以下错误

  

由于路径/ auth / signIn处的集成格式错误,因此无法解析API定义

我怎样才能像在我的模板指定我的lambda表达式的值ARN?

模板:

"api" : {
    "Type" : "AWS::Serverless::Api",
    "Properties" : {
        "StageName" : "prod",
        "DefinitionUri" : "src/api/swagger.json"
    }
},
"signIn": {
    "Type": "AWS::Serverless::Function",
    "Properties": {
        "Handler": "index.signIn",
        "Runtime": "nodejs8.10",
        "CodeUri": "./src",
        "FunctionName": "signIn",
        "ReservedConcurrentExecutions": 15,
        "Timeout": 5,
        "Events": {
            "SignIn": {
                "Type": "Api",
                "Properties": {
                    "Path": "/signIn",
                    "Method": "post",
                    "RestApiId" : {
                        "Ref": "api"
                    }
                }
            }
        }
    }
},

扬鞭定义:

"paths" : {
"/auth/signIn" : {
    "post" : {
        "x-amazon-apigateway-integration" : {
            "httpMethod" : "POST",
            "type" : "aws_proxy",
            "uri" : {
                "Fn::Sub" : {
                    "Fn::GetAtt": [
                    "signIn",
                    "Arn"
                ]}
            }
        },
        "parameters" : [
            {
                "name" : "email",
                "in" : "body",
                "required" : "true",
                "schema" : {
                    "type" : "string"
                }
            },
            {
                "name" : "password",
                "in" : "body",
                "required" : "true",
                "schema" : {
                    "type" : "string"
                }
            }
        ],
        "responses" : {
            "200" : {
                "description" : "Authenticated"
            },
            "default" : {
                "description" : "Unexpected Error"
            }
        }
    }
},

0 个答案:

没有答案