download free 30 days trial version buy bucket explorer
Documentation  Download  Purchase  Support  FAQs   Forum   ScreenShots & Demos

CloudFront - How to Update Public Distribution (GET Distribution, PUT Distribution)?

CloudFront is an Amazon Web Service, which can be used to deliver content with high speed and low latency. To distribute your content stored in Amazon S3 Bucket , or in some other data storage service, via CloudFront, you will need to create CloudFron Distributions . Once you create distributions, you can make changes to those distributions. When you make changes in distribution and save it, the request to update distribution is called and CloudFront starts to reflect the changes to all edge locations. CloudFront can take approximate 15 minutes to update changes to all edge location. As the status of distriubution converts from InProgress to Deployed , CloudFront immediately starts to serve updated content.

You can Update Public Distribution, by sending Http GET Distribution Config, PUT Distribution Config to CloudFront, in one of the two ways explained below:

  1. Update Public Distribution using CloudFront REST APIs - "GET Distribution Config, PUT Distribution Config" : If you are a programmer, you can write your own program to Update Public Distribution using CloudFront REST APIs - GET Distribution Config, PUT Distribution Config. On this website, we will only talk about REST APIs. Please refer to AWS documentation to learn more details on SOAP APIs.
  2. Update Public Distribution using Bucket Explorer : If you do not want to write code, you can easily Update Public Distribution with Bucket Explorer, in just few mouse clicks.

1. Update Public Distribution Using REST API:

You can perform Update Public Distribution operations by using Amazon CloudFront supported REST API in your application code.

  1. Perform a GET Distribution Config request to fetch current configuration and the Etag header for the distribution.

    Syntax: GET Distribution Config


    GET /2013-05-12/distribution/ distribution ID /config HTTP/1.1
    Host:cloudfront.amazonaws.com
    Authorization: AWS authentication string
    Date: time stamp
    Other required headers
     
  2. Make desired update on XML document that was returned in the response to your GET Distribution Config request.
  3. Submit a PUT Distribution Config request to update distribution with updated XML document.

    Syntax: PUT Distribution Config


    PUT /2013-05-12/distribution/ distribution ID /config HTTP/1.1
    Host: cloudfront.amazonaws.com
    If-Match: value from ETag header in previous GET response
    Authorization: AWS authentication string
    Other required headers

    <?xml version="1.0" encoding="UTF-8"?>
    <DistributionConfig xmlns="http://cloudfront.amazonaws.com/doc/2013-05-12/">
    <CallerReference> unique description for this
    distribution config </CallerReference>
    <Aliases>
    <Quantity> number of CNAME aliases </Quantity>
    <!-- Optional. Omit when Quantity = 0. -->
    <Items>
    <CNAME> CNAME alias </CNAME>
    </Items>
    </Aliases>
    <DefaultRootObject> URL for default root object </DefaultRootObject>
    <Origins>
    <Quantity> number of origins </Quantity>
    <Items>
    <Origin>
    <Id> unique identifier for this origin </Id>
    <DomainName> domain name of origin </DomainName>
    <!-- Include the S3OriginConfig element only if
    you use an Amazon S3 origin for your distribution. -->
    <S3OriginConfig>
    <OriginAccessIdentity>origin-access-identity/
    cloudfront/ ID </OriginAccessIdentity>
    </S3OriginConfig>
    <!-- Include the CustomOriginConfig element only if
    you use a custom origin for your distribution. -->
    <CustomOriginConfig>
    <HTTPPort> HTTP port that the custom origin
    listens on </HTTPPort>
    <HTTPSPort> HTTPS port that the custom origin
    listens on </HTTPSPort>
    <OriginProtocolPolicy>http-only |
    match-viewer</OriginProtocolPolicy>
    </CustomOriginConfig>
    </Origin>
    </Items>
    </Origins>
    <DefaultCacheBehavior>
    <TargetOriginId> ID of the origin that the default cache behavior
    applies to </TargetOriginId>
    <ForwardedValues>
    <QueryString>true | false</QueryString>
    <Cookies>
    <Forward>all | whitelist | none</Forward>
    <!-- Required when Forward = whitelist,
    omitted otherwise. -->
    <WhitelistedNames>
    <Quantity> number of cookie names to
    forward to origin </Quantity>
    <Items>
    <Name> name of a cookie to forward to
    the origin </Name>
    </Items>
    </WhitelistedNames>
    </Cookies>
    </ForwardedValues>
    <TrustedSigners>
    <Enabled>true | false</Enabled>
    <Quantity> number of trusted signers </Quantity>
    <!-- Optional. Omit when Quantity = 0. -->
    <Items>
    <AwsAccountNumber>self | AWS account that can create
    signed URLs </AwsAccountNumber>
    </Items>
    </TrustedSigners>
    <ViewerProtocolPolicy>allow-all |
    https-only</ViewerProtocolPolicy>
    <MinTTL> minimum TTL in seconds </MinTTL>
    </DefaultCacheBehavior>
    <CacheBehaviors>
    <Quantity> number of cache behaviors </Quantity>
    <!-- Optional. Omit when Quantity = 0. -->
    <Items>
    <CacheBehavior>
    <PathPattern> pattern that specifies files that this
    cache behavior applies to </PathPattern>
    <TargetOriginId> ID of the origin that this cache behavior
    applies to </TargetOriginId>
    <ForwardedValues>
    <QueryString>true | false</QueryString>
    <Cookies>
    <Forward>all | whitelist | none</Forward>
    <!-- Required when Forward = whitelist,
    omitted otherwise. -->
    <WhitelistedNames>
    <Quantity> number of cookie names to forward
    to origin </Quantity>
    <Items>
    <Name> name of a cookie to forward to
    the origin </Name>
    </Items>
    </WhitelistedNames>
    </Cookies>
    </ForwardedValues>
    <TrustedSigners>
    <Enabled>true | false</Enabled>
    <Quantity> number of trusted signers </Quantity>
    <!-- Optional. Omit when Quantity = 0. -->
    <Items>
    <AwsAccountNumber>self | AWS account that can create
    signed URLs </AwsAccountNumber>
    </Items>
    </TrustedSigners>
    <ViewerProtocolPolicy>allow-all |
    https-only</ViewerProtocolPolicy>
    <MinTTL> minimum TTL in seconds for files
    specified by PathPattern </MinTTL>
    </CacheBehavior>
    </Items>
    </CacheBehaviors>
    <Comment> comment about the distribution </Comment>
    <Logging>
    <Enabled>true | false</Enabled>
    <IncludeCookies>true | false</IncludeCookies>
    <Bucket> Amazon S3 bucket to save logs in </Bucket>
    <Prefix> prefix for log filenames </Prefix>
    </Logging>
    <ViewerCertificate>
    <IAMCertificateId> IAM certificate ID </IAMCertificateId> |
    <CloudFrontDefaultCertificate>true</CloudFrontDefaultCertificate>
    </ViewerCertificate>
    <PriceClass> maximum price class for the distribution </PriceClass>
    <Enabled>true | false</Enabled>
    </DistributionConfig>
     

2. Update Public Distribution Using Bucket Explorer:

You can perform the same Update Public Distribution operations using Bucket Explorer without writing a single line of code.

Steps for Updating Public distribution using Bucket Explorer:

  1. Run Bucket Explorer.
  2. Choose "Distribution" icon from Bucket table toolbar or you can do the same by selecting "Manage Distribution" option from right click menu option of any bucket.
  3. It displays a "Distribution" window having list of already created distributions.
  4. Select desired Public distribution to be updated and click on Update button.
  5. It will open panel for update Public (Download) distribution.
  6. Make desired update on your distribution and click on Update button.