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
Use GetDistributionConfig to get the current configuration, including the version identifier (ETag ).
Update the distribution configuration that was returned in the response. Note the following important requirements and restrictions:
You must rename the ETag field to IfMatch , leaving the value unchanged. (Set the value of IfMatch to the value of ETag , then remove the ETag field.)
You can’t change the value of CallerReference .
Submit an UpdateDistribution request, providing the 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.
When I get the file, I change the field from ETag to IfMatch, but I am getting errors regarding the format of the json.
Parameter validation failed:
Missing required parameter in DistributionConfig: "CallerReference"
Missing required parameter in DistributionConfig: "Origins"
Missing required parameter in DistributionConfig: "DefaultCacheBehavior"
Missing required parameter in DistributionConfig: "Comment"
Missing required parameter in DistributionConfig: "Enabled"
Unknown parameter in DistributionConfig: "IfMatch", must be one of: CallerReference, Aliases, DefaultRootObject, Origins, OriginGroups, DefaultCacheBehavior, CacheBehaviors, CustomErrorResponses, Comment, Logging, PriceClass, Enabled, ViewerCertificate, Restrictions, WebACLId, HttpVersion, IsIPV6Enabled
Unknown parameter in DistributionConfig: "DistributionConfig", must be one of: CallerReference, Aliases, DefaultRootObject, Origins, OriginGroups, DefaultCacheBehavior, CacheBehaviors, CustomErrorResponses, Comment, Logging, PriceClass, Enabled, ViewerCertificate, Restrictions, WebACLId, HttpVersion, IsIPV6Enabled
{
"ETag": "{{ cloudfront_distribution_id }}",
"DistributionConfig": {
"CallerReference": "{{ caller_reference }} ",
"Aliases": {
"Quantity": 1,
"Items": [
....
}