【问题标题】:Update the Lambda function to use the new Layer Version using Boto3使用 Boto3 更新 Lambda 函数以使用新的层版本
【发布时间】:2020-06-14 04:39:14
【问题描述】:

我有一个 lambda 函数,那个 lambda 正在使用层。我正在创建一个 boto3 来更新 lambda 函数以使用最新层。我只能在 AWS boto3 文档 (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.update_function_code) 中看到这个(参见下面的代码)。

response = client.update_function_code(
    FunctionName='string',
    ZipFile=b'bytes',
    S3Bucket='string',
    S3Key='string',
    S3ObjectVersion='string',
    Publish=True|False,
    DryRun=True|False,
    RevisionId='string'
)

我看不到指向新版本/更新的图层字段。

TIA。

【问题讨论】:

  • 添加了答案@Arun

标签: amazon-web-services boto3


【解决方案1】:

update_function_code 是代码更改的函数。您必须使用update_function_configuration 来更新层或任何其他配置

response = client.update_function_configuration(
    FunctionName='string',
    Role='string',
    Handler='string',
    Description='string',
    Timeout=123,
    MemorySize=123,
    VpcConfig={
        'SubnetIds': [
            'string',
        ],
        'SecurityGroupIds': [
            'string',
        ]
    },
    Environment={
        'Variables': {
            'string': 'string'
        }
    },
    Runtime='nodejs'|'nodejs4.3'|'nodejs6.10'|'nodejs8.10'|'nodejs10.x'|'nodejs12.x'|'java8'|'java11'|'python2.7'|'python3.6'|'python3.7'|'python3.8'|'dotnetcore1.0'|'dotnetcore2.0'|'dotnetcore2.1'|'dotnetcore3.1'|'nodejs4.3-edge'|'go1.x'|'ruby2.5'|'ruby2.7'|'provided',
    DeadLetterConfig={
        'TargetArn': 'string'
    },
    KMSKeyArn='string',
    TracingConfig={
        'Mode': 'Active'|'PassThrough'
    },
    RevisionId='string',
    Layers=[
        'string',
    ]
)

参考:https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.update_function_configuration

【讨论】:

    猜你喜欢
    • 2019-10-05
    • 1970-01-01
    • 2019-10-31
    • 1970-01-01
    • 1970-01-01
    • 2017-05-18
    • 2018-10-02
    • 2020-12-16
    • 2015-09-14
    相关资源
    最近更新 更多