Method: Aws::Lambda::Client#update_function_configuration

Defined in:
lib/aws-sdk-lambda/client.rb

#update_function_configuration(params = {}) ⇒ Types::FunctionConfiguration

Modify the version-specific settings of a Lambda function.

When you update a function, Lambda provisions an instance of the function and its supporting resources. If your function connects to a VPC, this process can take a minute. During this time, you can’t modify the function, but you can still invoke it. The ‘LastUpdateStatus`, `LastUpdateStatusReason`, and `LastUpdateStatusReasonCode` fields in the response from GetFunctionConfiguration indicate when the update is complete and the function is processing events with the new configuration. For more information, see [Lambda function states].

These settings can vary between versions of a function and are locked when you publish a version. You can’t modify the configuration of a published version, only the unpublished version.

To configure function concurrency, use PutFunctionConcurrency. To grant invoke permissions to an Amazon Web Services account or Amazon Web Services service, use AddPermission.

[1]: docs.aws.amazon.com/lambda/latest/dg/functions-states.html

Examples:

Example: To update a Lambda function’s configuration


# The following example modifies the memory size to be 256 MB for the unpublished ($LATEST) version of a function named
# my-function.

resp = client.update_function_configuration({
  durable_config: {
    execution_timeout: 3600, 
    retention_period_in_days: 45, 
  }, 
  function_name: "my-function", 
  memory_size: 256, 
})

resp.to_h outputs the following:
{
  code_sha_256: "PFn4S+er27qk+UuZSTKEQfNKG/XNn7QJs90mJgq6oH8=", 
  code_size: 308, 
  description: "", 
  durable_config: {
    execution_timeout: 3600, 
    retention_period_in_days: 45, 
  }, 
  function_arn: "arn:aws:lambda:us-east-2:123456789012:function:my-function", 
  function_name: "my-function", 
  handler: "index.handler", 
  last_modified: Time.parse("2019-08-14T22:26:11.234+0000"), 
  memory_size: 256, 
  revision_id: "873282ed-xmpl-4dc8-a069-d0c647e470c6", 
  role: "arn:aws:iam::123456789012:role/lambda-role", 
  runtime: "nodejs12.x", 
  timeout: 3, 
  tracing_config: {
    mode: "PassThrough", 
  }, 
  version: "$LATEST", 
}

Request syntax with placeholder values


resp = client.update_function_configuration({
  function_name: "FunctionName", # required
  role: "RoleArn",
  handler: "Handler",
  description: "Description",
  timeout: 1,
  memory_size: 1,
  vpc_config: {
    subnet_ids: ["SubnetId"],
    security_group_ids: ["SecurityGroupId"],
    ipv_6_allowed_for_dual_stack: false,
  },
  environment: {
    variables: {
      "EnvironmentVariableName" => "EnvironmentVariableValue",
    },
  },
  runtime: "nodejs", # accepts nodejs, nodejs4.3, nodejs6.10, nodejs8.10, nodejs10.x, nodejs12.x, nodejs14.x, nodejs16.x, java8, java8.al2, java11, python2.7, python3.6, python3.7, python3.8, python3.9, dotnetcore1.0, dotnetcore2.0, dotnetcore2.1, dotnetcore3.1, dotnet6, dotnet8, nodejs4.3-edge, go1.x, ruby2.5, ruby2.7, provided, provided.al2, nodejs18.x, python3.10, java17, ruby3.2, ruby3.3, ruby3.4, python3.11, nodejs20.x, provided.al2023, python3.12, java21, python3.13, nodejs22.x, nodejs24.x, python3.14, java25, dotnet10
  dead_letter_config: {
    target_arn: "ResourceArn",
  },
  kms_key_arn: "KMSKeyArn",
  tracing_config: {
    mode: "Active", # accepts Active, PassThrough
  },
  revision_id: "String",
  layers: ["LayerVersionArn"],
  file_system_configs: [
    {
      arn: "FileSystemArn", # required
      local_mount_path: "LocalMountPath", # required
    },
  ],
  image_config: {
    entry_point: ["String"],
    command: ["String"],
    working_directory: "WorkingDirectory",
  },
  ephemeral_storage: {
    size: 1, # required
  },
  snap_start: {
    apply_on: "PublishedVersions", # accepts PublishedVersions, None
  },
  logging_config: {
    log_format: "JSON", # accepts JSON, Text
    application_log_level: "TRACE", # accepts TRACE, DEBUG, INFO, WARN, ERROR, FATAL
    system_log_level: "DEBUG", # accepts DEBUG, INFO, WARN
    log_group: "LogGroup",
  },
  capacity_provider_config: {
    lambda_managed_instances_capacity_provider_config: { # required
      capacity_provider_arn: "CapacityProviderArn", # required
      per_execution_environment_max_concurrency: 1,
      execution_environment_memory_gi_b_per_v_cpu: 1.0,
    },
  },
  durable_config: {
    retention_period_in_days: 1,
    execution_timeout: 1,
  },
})

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", "nodejs16.x", "java8", "java8.al2", "java11", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "dotnet6", "dotnet8", "nodejs4.3-edge", "go1.x", "ruby2.5", "ruby2.7", "provided", "provided.al2", "nodejs18.x", "python3.10", "java17", "ruby3.2", "ruby3.3", "ruby3.4", "python3.11", "nodejs20.x", "provided.al2023", "python3.12", "java21", "python3.13", "nodejs22.x", "nodejs24.x", "python3.14", "java25", "dotnet10"
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.vpc_config.ipv_6_allowed_for_dual_stack #=> Boolean
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", "Deactivating", "Deactivated", "ActiveNonInvocable", "Deleting"
resp.state_reason #=> String
resp.state_reason_code #=> String, one of "Idle", "Creating", "Restoring", "EniLimitExceeded", "InsufficientRolePermissions", "InvalidConfiguration", "InternalError", "SubnetOutOfIPAddresses", "InvalidSubnet", "InvalidSecurityGroup", "ImageDeleted", "ImageAccessDenied", "InvalidImage", "KMSKeyAccessDenied", "KMSKeyNotFound", "InvalidStateKMSKey", "DisabledKMSKey", "EFSIOError", "EFSMountConnectivityError", "EFSMountFailure", "EFSMountTimeout", "InvalidRuntime", "InvalidZipFileException", "FunctionError", "DrainingDurableExecutions", "VcpuLimitExceeded", "CapacityProviderScalingLimitExceeded", "InsufficientCapacity", "EC2RequestLimitExceeded", "FunctionError.InitTimeout", "FunctionError.RuntimeInitError", "FunctionError.ExtensionInitError", "FunctionError.InvalidEntryPoint", "FunctionError.InvalidWorkingDirectory", "FunctionError.PermissionDenied", "FunctionError.TooManyExtensions", "FunctionError.InitResourceExhausted", "DisallowedByVpcEncryptionControl"
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", "KMSKeyAccessDenied", "KMSKeyNotFound", "InvalidStateKMSKey", "DisabledKMSKey", "EFSIOError", "EFSMountConnectivityError", "EFSMountFailure", "EFSMountTimeout", "InvalidRuntime", "InvalidZipFileException", "FunctionError", "VcpuLimitExceeded", "CapacityProviderScalingLimitExceeded", "InsufficientCapacity", "EC2RequestLimitExceeded", "FunctionError.InitTimeout", "FunctionError.RuntimeInitError", "FunctionError.ExtensionInitError", "FunctionError.InvalidEntryPoint", "FunctionError.InvalidWorkingDirectory", "FunctionError.PermissionDenied", "FunctionError.TooManyExtensions", "FunctionError.InitResourceExhausted", "DisallowedByVpcEncryptionControl"
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
resp.architectures #=> Array
resp.architectures[0] #=> String, one of "x86_64", "arm64"
resp.ephemeral_storage.size #=> Integer
resp.snap_start.apply_on #=> String, one of "PublishedVersions", "None"
resp.snap_start.optimization_status #=> String, one of "On", "Off"
resp.runtime_version_config.runtime_version_arn #=> String
resp.runtime_version_config.error.error_code #=> String
resp.runtime_version_config.error.message #=> String
resp.logging_config.log_format #=> String, one of "JSON", "Text"
resp.logging_config.application_log_level #=> String, one of "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"
resp.logging_config.system_log_level #=> String, one of "DEBUG", "INFO", "WARN"
resp.logging_config.log_group #=> String
resp.capacity_provider_config.lambda_managed_instances_capacity_provider_config.capacity_provider_arn #=> String
resp.capacity_provider_config.lambda_managed_instances_capacity_provider_config.per_execution_environment_max_concurrency #=> Integer
resp.capacity_provider_config.lambda_managed_instances_capacity_provider_config.execution_environment_memory_gi_b_per_v_cpu #=> Float
resp.config_sha_256 #=> String
resp.durable_config.retention_period_in_days #=> Integer
resp.durable_config.execution_timeout #=> Integer
resp.tenancy_config.tenant_isolation_mode #=> String, one of "PER_TENANT"

Options Hash (params):

See Also:



9462
9463
9464
9465
# File 'lib/aws-sdk-lambda/client.rb', line 9462

def update_function_configuration(params = {}, options = {})
  req = build_request(:update_function_configuration, params)
  req.send_request(options)
end