publish_version
¶
publish_version(
function_name: FunctionName,
*,
config_overrides: Optional[LambdaClientConfig] = 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/_lambda.py
5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 | |