amazon-web-servicesamazon-cloudfrontcdncontent-delivery-network

Amazon Cloudfront setup with own origin server


Hello there and thanks for reading my question.

I am looking into Amazon Cloudfront (CF) at the moment and need to define exactly the steps to setting up CF with our own origin server before I can proceed past inputting payment details. The basic steps I have been able to find out through Googling are:

  1. Register with CF
  2. Set-up a CF distribution (this is where you register your origin server)
  3. Update your resource references on your site

The problem I am having is with step 2. Although Amazon describe it as a simple API call, I am still not quite sure exactly what this means and what I would have to do to perform this call.

A lot of bloggers/forum posters suggest using a third party software like CloudBerry - the problem is is that CloudBerry costs to do the CF/origin server bit and I only need to do it once (everything else after that can be handled by the AWS management console.

I have looked at loads of other similar pieces of software but have found them to either error on download or on install or not have the functionality I am looking for on the Windows version!

Now, this page describes how to setup the origin server manually (http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/) but I am still not sure exactly how this is performed.

Has anyone done this before and can offer some guidance or step on how to do this?

Many thanks in advance!

Greg


Solution

  • I had success using Fog gem. Once you establish a connection to the Amazon API, it was painless to create a distribution.

    cdn = Fog::AWS::CDN.new(
      :aws_access_key_id => YOUR_ID,
      :aws_secret_access_key => YOUR_SECRET_KEY
    )
    
    cdn.post_distribution(options = YOUR_OPTIONS_HASH )
    

    And with that you should receive a 201.

    The documentation is great, too.