Skip to content

CloudFront  >  Operations  >  update_distribution

update_distribution

Operation

update_distribution async

update_distribution(input: UpdateDistributionInput, plugins: list[Plugin] | None = None) -> UpdateDistributionOutput

Updates the configuration for a CloudFront distribution.

The update process includes getting the current distribution configuration, updating it to make your changes, and then submitting an UpdateDistribution request to make the updates.

To update a web distribution using the CloudFront API

  1. Use GetDistributionConfig to get the current configuration, including the version identifier (ETag).

  2. Update the distribution configuration that was returned in the response. Note the following important requirements and restrictions:

    • You must copy the ETag field value from the response. (You'll use it for the IfMatch parameter in your request.) Then, remove the ETag field from the distribution configuration.

    • You can't change the value of CallerReference.

  3. Submit an UpdateDistribution request, providing the updated distribution configuration. The new configuration replaces the existing configuration. The values that you specify in an UpdateDistribution request are not merged into your existing configuration. Make sure to include all fields: the ones that you modified and also the ones that you didn't.

Parameters:

Name Type Description Default
input UpdateDistributionInput

An instance of UpdateDistributionInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
UpdateDistributionOutput

An instance of UpdateDistributionOutput.

Input

UpdateDistributionInput dataclass

Bases: _SerdeShape

The request to update a distribution.

Attributes

distribution_config class-attribute instance-attribute
distribution_config: DistributionConfig | None = ...

The distribution's configuration information.

id class-attribute instance-attribute
id: str | None = ...

The distribution's id.

if_match class-attribute instance-attribute
if_match: str | None = ...

The value of the ETag header that you received when retrieving the distribution's configuration. For example: E2QWRUHAPOMQZL.

Output

UpdateDistributionOutput dataclass

Bases: _SerdeShape

The returned result of the corresponding request.

Attributes

distribution class-attribute instance-attribute
distribution: Distribution | None = ...

The distribution's information.

e_tag class-attribute instance-attribute
e_tag: str | None = ...

The current version of the configuration. For example: E2QWRUHAPOMQZL.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.