Step 1: Upload your content to Amazon S3 and grant object permissions

  • Sign in to the AWS Management Console and open the Amazon S3 console
  • In the Amazon S3 console, choose Create Bucket.
  • In the Create Bucket dialog, enter a bucket name.
  • Select a region for your bucket. By default, Amazon S3 creates buckets in the US East (N. Virginia) region. We recommend that you choose a region close to you to optimize latency, minimize costs, or to address regulatory requirements.
  • Choose Create.
  • Select your bucket in the Buckets pane, and choose Upload.
  • On the Upload – Select Files page, choose Add Files, and choose the files that you want to upload.

  • Enable public read privileges for each object that you upload to your Amazon S3 bucket.
    1. Choose Set Details.
    2. On the Set Details page, choose Set Permissions.
    3. On the Set Permissions page, choose Make everything public.
  • Choose Start Upload.After the upload completes, you can navigate to this item by its URL. In the case of the previous example, the URL would be:http://s3.amazonaws.com/example-myawsbucket/filename

    Use your Amazon S3 URL to verify that your content is publicly accessible, but remember that this is not the URL you will use when you are ready to distribute your content.

First of all, select “S3 Bucket Policy” as the type of policy. It’ll then prompt you for a few pieces of information.
  • The Principal is the user who will be accessing the object. As we want everyone to access it, enter *.
  • As for Actions, we would like everyone to be able to execute the GetObject action and nothing else.
  • Just like the example below, the Amazon Resource Name should be something like:
  • arn:aws:s3:::/*
Our key name is * because we want people to access everything in this bucket.
Once you’re done, click Add Statement, then Generate Policy. You’ll end up with a policy that looks something like this:

Step 2: Create a CloudFront Web Distribution

To create a CloudFront web distribution

  1. Open the CloudFront console
  2. Choose Create Distribution.
  3. On the Select a delivery method for your content page, in the Web section, choose Get Started.

  • Choose Create Distribution.
  • After CloudFront has created your distribution, the value of the Status column for your distribution will change from InProgress to Deployed. If you chose to enable the distribution, it will then be ready to process requests. This should take less than 15 minutes.

Step 3: Test your links

To link to your objects

Copy the following HTML into a new file:


My CloudFront Test

My text content goes here.

domain name/object name” alt=”my test image”/>

For example, if your domain name was d111111abcdef8.cloudfront.net and your object was image.jpg, the URL for the link would be:

http://d111111abcdef8.cloudfront.net/image.jpg.

Open your web page in a browser to ensure that you can see your content.

Advertisements