Method: Aws::Lambda::Client#update_function_code
- Defined in:
- lib/aws-sdk-lambda/client.rb
#update_function_code(params = {}) ⇒ Types::FunctionConfiguration
Updates a Lambda function’s code. If code signing is enabled for the function, the code package must be signed by a trusted publisher. For more information, see [Configuring code signing][1].
The function’s code is locked when you publish a version. You can’t modify the code of a published version, only the unpublished version.
<note markdown=“1”> For a function defined as a container image, Lambda resolves the image tag to an image digest. In Amazon ECR, if you update the image tag to a new image, Lambda does not automatically update the function.
</note>
[1]: docs.aws.amazon.com/lambda/latest/dg/configuration-trustedcode.html
Examples:
Request syntax with placeholder values
Request syntax with placeholder values
resp = client.update_function_code({
function_name: "FunctionName", # required
zip_file: "data",
s3_bucket: "S3Bucket",
s3_key: "S3Key",
s3_object_version: "S3ObjectVersion",
image_uri: "String",
publish: false,
dry_run: false,
revision_id: "String",
})
Response structure
Response structure
resp.function_name #=> String
resp.function_arn #=> String
resp.runtime #=> String, one of "nodejs", "nodejs4.3", "nodejs6.10", "nodejs8.10", "nodejs10.x", "nodejs12.x", "nodejs14.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2"
resp.role #=> String
resp.handler #=> String
resp.code_size #=> Integer
resp.description #=> String
resp.timeout #=> Integer
resp.memory_size #=> Integer
resp.last_modified #=> Time
resp.code_sha_256 #=> String
resp.version #=> String
resp.vpc_config.subnet_ids #=> Array
resp.vpc_config.subnet_ids[0] #=> String
resp.vpc_config.security_group_ids #=> Array
resp.vpc_config.security_group_ids[0] #=> String
resp.vpc_config.vpc_id #=> String
resp.dead_letter_config.target_arn #=> String
resp.environment.variables #=> Hash
resp.environment.variables["EnvironmentVariableName"] #=> String
resp.environment.error.error_code #=> String
resp.environment.error.message #=> String
resp.kms_key_arn #=> String
resp.tracing_config.mode #=> String, one of "Active", "PassThrough"
resp.master_arn #=> String
resp.revision_id #=> String
resp.layers #=> Array
resp.layers[0].arn #=> String
resp.layers[0].code_size #=> Integer
resp.layers[0].signing_profile_version_arn #=> String
resp.layers[0].signing_job_arn #=> String
resp.state #=> String, one of "Pending", "Active", "Inactive", "Failed"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup", "ImageDeleted", "ImageAccessDenied", "InvalidImage"
resp.last_update_status #=> String, one of "Successful", "Failed", "InProgress"
resp.last_update_status_reason #=> String
resp.last_update_status_reason_code #=> String, one of "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup", "ImageDeleted", "ImageAccessDenied", "InvalidImage"
resp.file_system_configs #=> Array
resp.file_system_configs[0].arn #=> String
resp.file_system_configs[0].local_mount_path #=> String
resp.package_type #=> String, one of "Zip", "Image"
resp.image_config_response.image_config.entry_point #=> Array
resp.image_config_response.image_config.entry_point[0] #=> String
resp.image_config_response.image_config.command #=> Array
resp.image_config_response.image_config.command[0] #=> String
resp.image_config_response.image_config.working_directory #=> String
resp.image_config_response.error.error_code #=> String
resp.image_config_response.error.message #=> String
resp.signing_profile_version_arn #=> String
resp.signing_job_arn #=> String
Parameters:
-
params
(Hash)
(defaults to: {})
—
({})
Options Hash (params):
-
:function_name
(required, String)
—
The name of the Lambda function.
**Name formats**
-
**Function name** -
my-function. -
**Function ARN** -
arn:aws:lambda:us-west-2:123456789012:function:my-function. -
**Partial ARN** -
123456789012:function:my-function.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
-
-
:zip_file
(String, StringIO, File)
—
The base64-encoded contents of the deployment package. Amazon Web Services SDK and Amazon Web Services CLI clients handle the encoding for you.
-
:s3_bucket
(String)
—
An Amazon S3 bucket in the same Amazon Web Services Region as your function. The bucket can be in a different Amazon Web Services account.
-
:s3_key
(String)
—
The Amazon S3 key of the deployment package.
-
:s3_object_version
(String)
—
For versioned objects, the version of the deployment package object to use.
-
:image_uri
(String)
—
URI of a container image in the Amazon ECR registry.
-
:publish
(Boolean)
—
Set to true to publish a new version of the function after updating the code. This has the same effect as calling PublishVersion separately.
-
:dry_run
(Boolean)
—
Set to true to validate the request parameters and access permissions without modifying the function code.
-
:revision_id
(String)
—
Only update the function if the revision ID matches the ID that’s specified. Use this option to avoid modifying a function that has changed since you last read it.
Returns:
-
(Types::FunctionConfiguration)
—
Returns a response object which responds to the following methods:
-
#function_name => String
-
#function_arn => String
-
#runtime => String
-
#role => String
-
#handler => String
-
#code_size => Integer
-
#description => String
-
#timeout => Integer
-
#memory_size => Integer
-
#last_modified => Time
-
#code_sha_256 => String
-
#version => String
-
#vpc_config => Types::VpcConfigResponse
-
#dead_letter_config => Types::DeadLetterConfig
-
#environment => Types::EnvironmentResponse
-
#kms_key_arn => String
-
#tracing_config => Types::TracingConfigResponse
-
#master_arn => String
-
#revision_id => String
-
#layers => Array<Types::Layer>
-
#state => String
-
#state_reason => String
-
#state_reason_code => String
-
#last_update_status => String
-
#last_update_status_reason => String
-
#last_update_status_reason_code => String
-
#file_system_configs => Array<Types::FileSystemConfig>
-
#package_type => String
-
#image_config_response => Types::ImageConfigResponse
-
#signing_profile_version_arn => String
-
#signing_job_arn => String
-
See Also:
4622 4623 4624 4625 |
# File 'lib/aws-sdk-lambda/client.rb', line 4622 def update_function_code(params = {}, options = {}) req = build_request(:update_function_code, params) req.send_request(options) end |