PublishFunction - Amazon CloudFront


Publishes a CloudFront function by copying the function code from the DEVELOPMENT stage to LIVE. This automatically updates all cache behaviors that are using this function to use the newly published copy in the LIVE stage.

When a function is published to the LIVE stage, you can attach the function to a distribution's cache behavior, using the function's Amazon Resource Name (ARN).

To publish a function, you must provide the function's name and version (ETag value). To get these values, you can use ListFunctions and DescribeFunction.

Request Syntax

POST /2020-05-31/function/Name/publish HTTP/1.1 If-Match: IfMatch

URI Request Parameters

The request uses the following URI parameters.


The current version (ETag value) of the function that you are publishing, which you can get using DescribeFunction.

Required: Yes


The name of the function that you are publishing.

Required: Yes

Request Body

The request does not have a request body.

Response Syntax

HTTP/1.1 200 <?xml version="1.0" encoding="UTF-8"?> <FunctionSummary> <FunctionConfig> <Comment>string</Comment> <KeyValueStoreAssociations> <Items> <KeyValueStoreAssociation> <KeyValueStoreARN>string</KeyValueStoreARN> </KeyValueStoreAssociation> </Items> <Quantity>integer</Quantity> </KeyValueStoreAssociations> <Runtime>string</Runtime> </FunctionConfig> <FunctionMetadata> <CreatedTime>timestamp</CreatedTime> <FunctionARN>string</FunctionARN> <LastModifiedTime>timestamp</LastModifiedTime> <Stage>string</Stage> </FunctionMetadata> <Name>string</Name> <Status>string</Status> </FunctionSummary>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.


Root level tag for the FunctionSummary parameters.

Required: Yes


Contains configuration information about a CloudFront function.

Type: FunctionConfig object


Contains metadata about a CloudFront function.

Type: FunctionMetadata object


The name of the CloudFront function.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [a-zA-Z0-9-_]{1,64}


The status of the CloudFront function.

Type: String


For information about the errors that are common to all actions, see Common Errors.


An argument is invalid.

HTTP Status Code: 400


The If-Match version is missing or not valid.

HTTP Status Code: 400


The function does not exist.

HTTP Status Code: 404


The precondition in one or more of the request fields evaluated to false.

HTTP Status Code: 412


This operation is not supported in this region.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: