Who doesn’t love WordPress? It is responsible for somewhere around 19% of the web’s content and if you’ve never used it you should give it a try. Who doesn’t want to learn how to use AWS? Well probably most people but I’ve been liking the granular control of AWS since I started playing around with it. If you want to give it a spin, here is a brief tutorial that should get you up and running in about a half hour and give you a look at many of the key components.
First of all you are going to need to set yourself up, depending upon your OS and what you already have going on, you are going to need to install an SSH client, Putty is a great free tool and the software of choice for most, but I actually like the free edition of MobaXTerm as it automatically supports the .pem public key format from amazon, is more colorful and has SFTP built right in.
You will be using the terminal, SSH and the Linux command line for this project.
Next head over to AWS.amazon.com and sign up for a free tier account. This will allow you to use up to 750 hours of hosting for free among other things.
Once you have done all the verification steps and are able to log into the AWS console head to the EC2 Managment Console
In the Network and Security section make a new keypair and download the .pem file to your computer and put it in a safe location. This is the public key encryption information that take the place of a password for your server. It is more secure tan a simple password as long as you keep the file away from prying eyes. In fact on Linux and OSX you will need to chang the permissions of the .pem file to 600 (Only You can Read and Write all others forbidden) in order to use it to connect. You can do this simply on the command line using:
sudo chmod 600 /pathtoyourfile/keyname.pem
Now you can use your terminal program of choice to connect to your server isntance once you create it in AWS.
Now you can go ahead and head back to the root of the AWS console by clicking the orange box in the upper left. Now head over to Cloud Formation.
This is where you can set up templates for server instances that you can create on demand. Click the “Create Stack” button to begin the process you can tinker with custom test based templates to your heart’s content in the future, but for now give your template a name like “WordPressLab” and use the following URL in the “Provide a Template URL field”
In the next screen enter strong passwords. You’ll need to enter your key name that you chose and CHANGE THE INSTANCE type to:
If you do not enter the key exactly you will not be able to connect and if you do not change the instance type it won’t be free. If you have a static ip address for your home computer or dont mind changing this seting frequently for added security change the SSH Address to 126.96.36.199/32 where the 1’s are your systems static IP address, that way only that system can log in through SSH with the encrypted key.
Skip by the “Tags” screen and you should get to the confirmation screen.
and clear the next screen and you should see this in the Cloud Formation console:
Head back on over to the EC2 Instance Manager where you made the Key Pair and take a 5 minute coffee break.
You should now have a running WordPress Web Server and the console will look somewhat like this:
The IP address listed there is a public IP and you can put it in a new browser window and you will see that your Apache is up and running just fine.
If you head to http://yourserverIP/wordpress/ the wizard will let you create a login to your new blog. Its easy as pie from there.
However, you are not done that easily. Unfortunately your server does not support pretty hyperlinks so your blog posts will always have ugly names and you really don’t want that. Also you should know how to login to your server via SSH so fire up your terminal program.
If you are using ModXterm you simply need to set up an new connection and chose the .pem key in the connection screen, the username is
Its similar using putty but you need to use putty convert to to change the pem file to a ptk file, just google that. This is not a Putty or ModXterm article.
If you are using a linux or OSX terminal use:
ssh ec2-user@yourserverip -i /pathtopemfile/keyname.pem
Add the server with a yes and you are greeted with:
:~ user$ ssh ec2-user@yourserverip -i /pathtokey/keyname.pem The authenticity of host 'yourserverip' can't be established. RSA key fingerprint is a5:44:98:e9:88:c9:ea:ec:24:26:eb:a2:fb:13:ce:46. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'your server ip' (RSA) to the list of known hosts. __| __|_ ) _| ( / Amazon Linux AMI ___|\___|___| See /usr/share/doc/system-release/ for latest release notes. There are 38 security update(s) out of 243 total update(s) available Amazon Linux version 2013.09 is available. [ec2-user@ip-172-31-7-36 ~]$
Now you are in, you can use the SUDO command to do root things and have control to your heart’s content. In order to enable the pretty hyperlinks you ned to issue the following command, this is assuming you know how to use the vi editor:
sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup
sudo vi /etc/httpd/conf/httpd.conf
Find the section here:
And change BOTH instances of:
Save your file and then use
sudo httpd -k restart
Now you are ready to log back into your wordpress blog, head to settings>permalinks and choose the permalink you you want. You are also ready to SSH in when you need to!