How to create a CloudFront Distribution for S3 Media Maestro
In order to take advantage of CloudFront distributions, you will need to create an AWS S3 bucket and a CloudFront distribution. You may already have a bucket set up, however, we will walk through the steps starting with a bucket.
- Log into your AWS account and navigate to S3.
- Click Create a Bucket and name your bucket. Here is a link to Amazon's documentation for proper bucket naming practices. You don't need to worry about the region as CloudFront doesn't require a specific region.
- Navigate to Services→CloudFront.
- Click Create Distribution.
- Find the Web section and click Get Started.
- Now you will need to configure your distribution.
- In the Origin Domain Name field, simply select the bucket that you'd like to assign to the distribution.
- If you want to target a specific folder within that bucket, you can add a folder in the Origin Path field. Be sure to add the "/" before the folder name.
- Select Yes on the option for Restrict Bucket Access. This will allow CloudFront to access the S3 Bucket.
- Next to Origin Access Identity select Create a New Identity.
- You can make the ID as descriptive as you'd like in the Comment field or simply leave the default.
- Lastly, select Yes, Update Bucket Policy next to Grant Read Permissions on Bucket.
[NOTE] - Keep in mind that only this identity will have access to the bucket because a policy will be applied to the bucket. You may want to consider creating a separate bucket to place "public assets" in, otherwise they won't be accessible in this bucket due to the policy.
- The last setting essential for the distribution is:
- Select Yes for Restrict Viewer Access (Use Signed URLs or Signed Cookies). This will require the URLs generated by S3 Media Maestro to be properly signed for protection.
- Last, be sure to select Self for the Trusted Signers.
- Then click Create Distribution at the bottom right hand corner. The distribution will take up to 15 minutes to create and deploy.
- Click on Distributions in the upper left hand corner to check the status of the distribution. Once the status reads Deployed and the state reads Enabled then the URL is ready to use.
- Simply copy the Domain Name (i.e. dhtdbs1lmasph.cloudfront.net) and insert it into the CloudFront Distribution URL on the Settings page of S3 Media Maestro. One last thing to note is that this URL is the default distribution URL, however, you can specify a different distribution URL with in the shortcode parameters.