Reputation: 81
I have a lambda function and that lambda is using the layers. I am creating a boto3 to update the lambda function to use the latest layer. I can see only this(see code below) in the AWS boto3 document (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'
)
I cannot see the layer field there to point the new version/update.
TIA.
Upvotes: 0
Views: 3289
Reputation: 9301
update_function_code
is function to changes in code. You have to use update_function_configuration
to update layer or any other 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',
]
)
Upvotes: 2