Sunday, December 28, 2014

Amazon S3 Fully Integrated aka How To Integrate S3

Today I was able to fully integrate us with Amazon S3 hosting.

We had already created a bucket a few weeks ago that we were pushing all the new images to.  The last step was to make it so we start pulling from that bucket instead of our local hosting.

First thing to do is decide what your domain name for hosting images will be.  Ours is going to be i.jeepparking.com.  We'll get into why this is important in a few.

Next thing to do was create a Cloudfront Distribution based off of our bucket.  This is done through your Amazon AWS control panel.  Since most of our users are located in the USA, we selected just US and European servers as opposed to the full blown worldwide distribution.  Besides that, we used most of the default settings.  For Alternate Domain Names, you will want to enter the domain you previously selected (ex. i.jeepparking.com).  Once you go through that process, you will be redirected to your Cloudfront Distributions summary page.  In there you will see a few columns, most important ones being Domain Name and State.  State will probably be Processing or something along those lines.  When it says Enabled, you will be ready to go.  This took ~10 minutes for me.  The value in Domain Name is what we will use in the next step.

While that's working, let's create your CNAME.  The CNAME will allow us to point the domain you selected (or in our case, i.jeepparking.com) to your new Cloudfront Distribution.  Unfortunately this part is going to greatly depend on who you have your domain with.  I use MediaTemple for hosting all of that, so in their DNS editor I added a new dns entry.

Name is: i.jeepparking.com
Type is: CNAME
Data is: The value in Domain Name.  It's probably something like asdfhk13jhrcsak2j.cloudfront.net.

Add that record.  Most DNS updates go through pretty quickly, but I've heard of them taking 24 hours at times.

At this point, I started refreshing the Cloudfront Distributions summary page at AmazonAWS.  After about 10 minutes, mine went from Processing to Enabled.  I then went to i.jeepparking.com and sure enough, it redirected me to my bucket.

I then went through all the spots on my site that pull from my local jeep directory and switched them over to the i. subdomain.  Fortunately the way our site is set up, it was a pretty straight forward update.

This information wasn't super easy to find, so hopefully this'll help anyone else trying to figure out how to set up Amazon S3 with their own subdomain.

No comments:

Post a Comment