小编Jef*_*y M的帖子

将来自CloudFormation的ARN引用传递给Swagger

我们正在尝试使用Amazon CloudFormation和Swagger自动部署AWS lambda和API网关.为此,我们创建了一个CloudFormation模板来创建APIGateway所需的Lambda和其他资源(包括端点).我们希望从外部swagger文件导入API定义,以便相同的CloudFormation模板可用于多个lambdas和APIGateways.有没有办法可以引用由外部swagger文件(在同一个CloudFormation模板中引用)中由CloudFormation模板创建的lambda的ARN,该文件包含API定义?

Swagger内容:

"x-amazon-apigateway-integration": {
              "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:TestSimpleProxy/invocations",
              "passthroughBehavior": "when_no_match",
              "httpMethod": "POST",
              "type": "aws_proxy"
            }
Run Code Online (Sandbox Code Playgroud)

在上面的集成方法中,我需要从云形成模板中动态替换uri的值.

我的云形成脚本如下:

"myApi":{
      "Type" : "AWS::ApiGateway::RestApi",
      "Properties" : {
        "BodyS3Location" : S3Location of the swagger definition file,
        ..,
        ..
      }
    }
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation swagger aws-lambda aws-api-gateway

4
推荐指数
2
解决办法
4675
查看次数