update_function_configuration
async
¶
update_function_configuration(
function_name: FunctionName,
*,
config_overrides: Optional[AsyncLambdaClientConfig] = None,
role: Optional[RoleArn] = None,
handler: Optional[Handler] = None,
description: Optional[Description] = None,
timeout: Optional[Timeout] = None,
memory_size: Optional[MemorySize] = None,
vpc_config: Optional[VpcConfig] = None,
environment: Optional[Environment] = None,
runtime: Optional[Runtime] = None,
dead_letter_config: Optional[DeadLetterConfig] = None,
kms_key_arn: Optional[KMSKeyArn] = None,
tracing_config: Optional[TracingConfig] = None,
revision_id: Optional[String] = None,
layers: Optional[LayerList] = None,
file_system_configs: Optional[FileSystemConfigList] = None,
image_config: Optional[ImageConfig] = None,
ephemeral_storage: Optional[EphemeralStorage] = None,
snap_start: Optional[SnapStart] = None,
logging_config: Optional[LoggingConfig] = None,
capacity_provider_config: Optional[CapacityProviderConfig] = None,
durable_config: Optional[DurableConfig] = None,
) -> FunctionConfiguration
Modifies the version-specific settings of a Lambda Event 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.
Parameters:
-
function_name(FunctionName) –The name or ARN 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.
-
-
role(Optional[RoleArn], default:None) –The Amazon Resource Name (ARN) of the function's execution role.
-
handler(Optional[Handler], default:None) –The name of the method within your code that Lambda calls to run your function. Handler is required if the deployment package is a .zip file archive. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see Lambda programming model.
-
description(Optional[Description], default:None) –A description of the function.
-
timeout(Optional[Timeout], default:None) –The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 3 seconds, and the maximum allowed value is 900 seconds. For functions using Lambda Managed Instances, asynchronous invocations and event source mapping invocations (except Amazon MQ and Amazon DocumentDB) support a maximum allowed value of 5,400 seconds (90 minutes). For more information, see Lambda execution environment.
-
memory_size(Optional[MemorySize], default:None) –The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB.
-
vpc_config(Optional[VpcConfig], default:None) –For network connectivity to Amazon Web Services resources in a VPC, specify a list of security groups and subnets in the VPC. When you connect a function to a VPC, it can access resources and the internet only through that VPC. For more information, see Configuring a Lambda function to access resources in a VPC.
-
environment(Optional[Environment], default:None) –Environment variables that are accessible from function code during execution.
-
runtime(Optional[Runtime], default:None) –The identifier of the function's runtime. Runtime is required if the deployment package is a .zip file archive. Specifying a runtime results in an error if you're deploying a function using a container image.
The following list includes deprecated runtimes. Lambda blocks creating new functions and updating existing functions shortly after each runtime is deprecated. For more information, see Runtime use after deprecation.
For a list of all currently supported runtimes, see Supported runtimes.
-
dead_letter_config(Optional[DeadLetterConfig], default:None) –A dead-letter queue configuration that specifies the queue or topic where Lambda sends asynchronous events when they fail processing. For more information, see Dead-letter queues.
-
kms_key_arn(Optional[KMSKeyArn], default:None) –The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt the following resources:
-
The function's environment variables.
-
The function's Lambda SnapStart snapshots.
-
When used with
SourceKMSKeyArn, the unzipped version of the .zip deployment package that's used for function invocations. For more information, see Specifying a customer managed key for Lambda. -
The optimized version of the container image that's used for function invocations. Note that this is not the same key that's used to protect your container image in the Amazon Elastic Container Registry (Amazon ECR). For more information, see Function lifecycle.
If you don't provide a customer managed key, Lambda uses an Amazon Web Services owned key or an Amazon Web Services managed key.
-
-
tracing_config(Optional[TracingConfig], default:None) –Set
ModetoActiveto sample and trace a subset of incoming requests with X-Ray. -
revision_id(Optional[String], default:None) –Update the function only 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.
-
layers(Optional[LayerList], default:None) –A list of function layers to add to the function's execution environment. Specify each layer by its ARN, including the version.
-
file_system_configs(Optional[FileSystemConfigList], default:None) –Connection settings for an Amazon EFS file system or an Amazon S3 Files file system.
-
image_config(Optional[ImageConfig], default:None) –Container image configuration values that override the values in the container image Docker file.
-
ephemeral_storage(Optional[EphemeralStorage], default:None) –The size of the function's
/tmpdirectory in MB. The default value is 512, but can be any whole number between 512 and 10,240 MB. For more information, see Configuring ephemeral storage (console). -
snap_start(Optional[SnapStart], default:None) –The function's SnapStart setting.
-
logging_config(Optional[LoggingConfig], default:None) –The function's Amazon CloudWatch Logs configuration settings.
-
capacity_provider_config(Optional[CapacityProviderConfig], default:None) –Configuration for the capacity provider that manages compute resources for Lambda functions.
-
durable_config(Optional[DurableConfig], default:None) –Configuration settings for durable functions, including execution timeout, retention period for execution history, and an optional ARN of the Key Management Service (KMS) customer managed key that is used to encrypt your durable execution's payload data, including input, output, and error payloads.
Raises:
-
CodeSigningConfigNotFoundException–The specified code signing configuration does not exist.
-
CodeVerificationFailedException–The code signature failed one or more of the validation checks for signature mismatch or expiry, and the code signing policy is set to ENFORCE. Lambda blocks the deployment.
-
InvalidCodeSignatureException–The code signature failed the integrity check. If the integrity check fails, then Lambda blocks deployment, even if the code signing policy is set to WARN.
-
InvalidParameterValueException–One of the parameters in the request is not valid.
-
PreconditionFailedException–The RevisionId provided does not match the latest RevisionId for the Lambda function or alias.
-
For AddPermission and RemovePermission API operations: Call
GetPolicyto retrieve the latest RevisionId for your resource. -
For all other API operations: Call
GetFunctionorGetAliasto retrieve the latest RevisionId for your resource.
-
-
ResourceConflictException–The resource already exists, or another operation is in progress.
-
ResourceNotFoundException–The resource specified in the request does not exist.
-
ServiceException–The Lambda service encountered an internal error.
-
TooManyRequestsException–The request throughput limit was exceeded. For more information, see Lambda quotas.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
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.
>>> await client.update_function_configuration(durable_config={'ExecutionTimeout': 3600, 'RetentionPeriodInDays': 45}, function_name='my-function', memory_size=256)
Source code in docs_src/capo_lambda/_services/async__lambda.py
3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 | |