【问题标题】:how to add the command 'Use Lambda Proxy integration' while creating api-gateway using boto3如何在使用 boto3 创建 api-gateway 时添加命令“使用 Lambda 代理集成”
【发布时间】:2019-11-23 13:30:32
【问题描述】:

我正在使用 boto3 在 aws 中为我的 lambda 函数创建一个 api。那么如何在为该 api 创建资源时添加具有 lambda 代理集成的选项。

我正在使用 put_method 为我的 api 及其方法类型创建资源

api_client.put_method(restApiId=api_id,
                              resourceId=name_api_id,
                              httpMethod='ANY',
                              authorizationType='NONE')

【问题讨论】:

    标签: python-3.x amazon-web-services aws-lambda aws-api-gateway boto3


    【解决方案1】:

    对于 aws lambda 集成,请改用 put_integration。

    您应该在下面指定您的字符串,请记住,对于 lambda 代理集成,您应该指定

    type='AWS_PROXY'
    integrationHttpMethod='POST'
    uri = lambda url 
    

    这里是全部

    response = client.put_integration(
        restApiId='string',
        resourceId='string',
        httpMethod='string',
        type='HTTP'|'AWS'|'MOCK'|'HTTP_PROXY'|'AWS_PROXY',
        integrationHttpMethod='string',
        uri='string',
        connectionType='INTERNET'|'VPC_LINK',
        connectionId='string',
        credentials='string',
        requestParameters={
            'string': 'string'
        },
        requestTemplates={
            'string': 'string'
        },
        passthroughBehavior='string',
        cacheNamespace='string',
        cacheKeyParameters=[
            'string',
        ],
        contentHandling='CONVERT_TO_BINARY'|'CONVERT_TO_TEXT',
        timeoutInMillis=123
    )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-08
      • 1970-01-01
      • 2017-01-22
      • 1970-01-01
      • 2021-06-30
      • 2020-03-10
      • 2018-05-04
      • 2017-10-01
      相关资源
      最近更新 更多