This evening I had an AWS learning experience. It started with my desire to remove a persistent banner message from my website.
First a little background.
I setup this site using the WordPress Powered by Bitnami AMI. The setup was quick and straight forward. With a little Amazon Route 53 magic I quickly had both my www.NatThompson.com A record and NatThompson.com CNAME handling any request the web could throw at me. I was rocking!
But there was a catch…
The Bitnami banner continuously displayed in the lower right of the web page as a turned up corner. “Hmmmm…. I’ll have to clear that off” I thought, but first I decided to go ahead and setup all of my website content and configuration. Off I went downloading plugins and themes and tweaking them until they were Juuuust right.
Eventually I was ready to do away with the banner once and for all. So I clicked on it to see what help it would offer. Low and behold, it pointed my on my path right away. It showed me this promising paragraph.
Clicking along I was informed that the next step was to issue a command from the command line of the server hosting the website.
Even more hopeful. All I needed to do was connect to the secure shell for the server, issue the command, and be on my way.
So I navigated my way to my EC2 console to connect to the server. When I clicked on the web based console I received a message that I did not have an associated key for the instance. Oh crap!
So now what to do?
The solution I settled on was to take a snapshot of the instance and then launch a new instance from that AMI. It would run side by side with the existing image until I could confirm everything was working properly and then I would switch the A record for my domain to the new server using Amazon Route 53.
So that’s what I did.
In the EC2 console I selected the instance and from the Actions drop down list I selected Image > Create Image. In just a few minutes the image was complete and I had an AMI ready to launch.
I clicked the Launch Image button on the EC2 instances screen and selected the My Images tab. I chose the AMI I had just created and clicked the Select button.
From there I walked through the setup steps, making sure to create a new Key File for this image. In a matter of minutes the image was up and running. I browsed to the site using the public DNS address for the new website and verified everything was as it should be.
I then used the web based shell console to connect to the server and run the command to disable the banner. Remember how all of this started?
A quick refresh showed the banner was gone. Now I was ready to switch my domain to point to the new server.
I opened the Route 53 DNS manager and changed my A record to point to the new IP address. I opened a new browser window and entered the URL for my site. I knew DNS could take a little while to propagte so I waited five minutes and refreshed my browser screen. Viola! The new, banner free, site was displayed.
I kept the old site up and running for a couple days to give my change the chance to propagate to all the dark corners of the Internet then shut it down.
And thus ends my tale.
All in all the process was very easy to get working. Granted if I had not mistakenly not created a key when I set up the site a lot of this would have been unnecessary but given that I didn’t the process wasn’t frustrating or difficult.
So all in all a successful exercise.
What’s been your experience with EC2, AMIs and Route 53? Please leave your stories in the comments below.