publish_version
async
¶
publish_version(
function_name: FunctionName,
*,
config_overrides: Optional[AsyncLambdaClientConfig] = None,
code_sha256: Optional[String] = None,
description: Optional[Description] = None,
revision_id: Optional[String] = None,
publish_to: Optional[FunctionVersionLatestPublished] = None,
) -> FunctionConfiguration
Creates a version from the current code and configuration of a function. Use versions to create a snapshot of your function code and configuration that doesn't change.
Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version.
Clients can invoke versions directly or with an alias. To create an alias, use CreateAlias.
Parameters:
-
function_name(FunctionName) –The name or ARN of the Lambda function.
Name formats
-
Function name -
MyFunction. -
Function ARN -
arn:aws:lambda:us-west-2:123456789012:function:MyFunction. -
Partial ARN -
123456789012:function:MyFunction.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
-
-
code_sha256(Optional[String], default:None) –Only publish a version if the hash value matches the value that's specified. Use this option to avoid publishing a version if the function code has changed since you last updated it. You can get the hash for the version that you uploaded from the output of UpdateFunctionCode.
-
description(Optional[Description], default:None) –A description for the version to override the description in the function configuration.
-
revision_id(Optional[String], default:None) –Only update the function if the revision ID matches the ID that's specified. Use this option to avoid publishing a version if the function configuration has changed since you last updated it.
-
publish_to(Optional[FunctionVersionLatestPublished], default:None) –Specifies where to publish the function version or configuration.
Raises:
-
CodeStorageExceededException–Your Amazon Web Services account has exceeded its maximum total code size. For more information, see Lambda quotas.
-
FunctionVersionsPerCapacityProviderLimitExceededException–The maximum number of function versions that can be associated with a single capacity provider has been exceeded. For more information, see Lambda quotas.
-
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 publish a version of a Lambda function This operation publishes a version of a Lambda function
Source code in docs_src/capo_lambda/_services/async__lambda.py
5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 | |