We’re all about helping people build their awesome ideas here at POP. What better way to kick off a hackathon or build an MVP than setting yourself up with a free Amazon EC2 instance with Elastic Block Storage and Relational Data Service for free. We’ll walk you through a step by step guide on how to configure your new Amazon AWS account as well as provide you with a simple bash script to automatically setup and configure WordPress on your newly created machine. If you’ve got 15 to 30 minutes to spare, let’s get you some free shit thanks to Amazon AWS’s Free Tier.
In this guide, you’ll learn how to provision a new Amazon Elastic Cloud (EC2) instance running Ubuntu 14.04 LTS, attach it to Amazon Elastic Block Storage (EBS), and setup Amazon Relational Data Service (RDS) to act as your MySQL database. We’ve made it an instructional walkthrough complete with screenshots. Follow along closely, young grasshopper!
A word of warning: This guide may stretch your limits if you’re uncomfortable with words like SSH, MySQL, private keys, or opening up your terminal/console.
We’ve broken this guide down into 5 sections to keep it manageable:
- Register a Domain with POP
- Create a Free Amazon AWS Account
- Create your EC2 Instance
- Add New DNS Records to POP for your new EC2 Instance
- Setup WordPress on your new EC2 Instance
Step 1: Register a Domain with POP
This part’s easy. Each of our partnering coding school students and hackathon participants (i.e. Startup Weekend) are offered a free POP account for a year including a .CO domain name with full domain control in partnership with our friends at .CO. If you don’t have a promo code for POP, you won’t have Full Domain Control to point your domain (modify your DNS) unless you upgrade your domain’s Simple DNS plan for $2/mo. You can upgrade Simple DNS with this link once you’ve registered for your free domain with POP. You can click here to begin searching for an available domain name on POP.
It’s worth noting that you can enter several keywords, separated by spaces, into the domain search tool when registering a domain. This effectively will search for similar domains and make suggestions based on domain availability.
Step 2: Create a Free Amazon AWS Account
To initiate registration of the Amazon AWS Free Tier, visit https://aws.amazon.com/free/. This page also outlines all of the features included free for one year. There’s tons of amazing services at your disposal, including the new AWS IoT Beta. It’s worth your time to review the services offered by the free tier and their individual overage limits.
To create your free Amazon Web Services (AWS) account, you’ll need a valid credit card and cell phone. In the event you receive more traffic than allowed by Amazon’s free tier limits, you will be charged overages, hence the need for a verified credit card. Click on the yellow “Create a Free Account” button to begin.
You’ll be presented with a page to either sign in or create a new AWS account. This is where you can create a new account with your new POP email address. Simply enter the new email address to your POP account and click the yellow button to “Sign in using our secure secure”.
Next, you’ll be presented with a screen to enter some basic account information. You will want to ensure you use the same email address you entered in the first step here. Click on “Create account” to continue the registration process.
Next, Amazon requires you to enter contact information. You’ll need a valid address and phone number at this step. Complete the form fields and click on “Create Account and Continue”.
After having entered your contact information, you will be presented with yet another form to enter your payment information. It’s worth mentioning again that you will not be charged. Enter your valid credit or debit card information and click on “Continue”.
Now that you’ve entered your payment information, Amazon also requires you to verify a valid phone number. The number you enter here will be called and provided a PIN number for verification, so please enter a valid number and click “Call Me Now”. Amazon will immediately dial your phone and provide you with a number to enter into step 3 of the current screen. Enter the PIN and click the yellow button continue.
On the following Support Plan screen, you can simply leave the default Basic (Free) support plan selected. Click “Continue”.
Congratulations! You’ve successfully completed the registration process for your new Amazon AWS account! You’ll be presented with the following screen. Click on “Sign in to the Console” to continue.
Now that you officially have an AWS account, you can select the option “I am a returning user and my password is:” and enter the password you selected. Click on “Sign in using our secure server”.
Now, follow along with the next section of our guide, Creating your EC2 Instance, to create your first Amazon EC2 instance.
Step 3: Create your EC2 Instance
Once you’re logged in to your new AWS account, navigate over to the EC2 Management Console. You can simply click the link provided or find and click “EC2” from the massive list of services (as seen in the image below). It’s the first option.
To start using Amazon EC2 you will want to launch a virtual server, known as an Amazon EC2 instance. From within your EC2 Dashboard, click on the blue button “Launch instance”:
Select an Amazon Machine Image (AMI). We recommend Ubuntu Server 14.04 LTS for its widespread adoption and long term support. Our bash scripts later assume you have chosen Ubuntu Server 14.04 LTS:
Select the t2.micro instance type as it’s the only instance eligible for the free tier. Click “Next:Configure Instance Details” at the bottom of the page to continue.
On the Configure Instance Details page, you should be able to safely keep the default settings. Click on “Next: Add Storage” to continue.
The default storage is 8GB. We recommend adjusting this to the maximum allowable for the free tier, which is 30GB. Once you’ve adjusted your storage (disk) size, Click “Next: Tag Instance”.
Enter a name for your machine instance. We chose “wordpress-aws” but you can name it however you’d like. Click “Next: Configure Security Group”.
You need to add a few rules to your security group in order to make your WordPress site accessible to the internet.
- Click ‘Add Rule’. Select ‘HTTP’ from ‘Type’.
- Click ‘Add Rule’. Select ‘SMTP’ from ‘Type’.
- Click the button ‘Review and Launch’.
On this screen, check if all of your settings are correct from the previous EC2 setup steps. Once you have confirmed your settings, click “Launch”.
You will see a popup titled “Select an existing key pair or create a new key pair” as detailed in the image below. Skip to the next step to create a new keypair.
Click on the dropdown and select the option “create a new key pair”. Next, click on the button “Download Key Pair” and save this somewhere you won’t lose it. If you are comfortable with selecting an existing keypair and understand the implications, you may chose to do so. We opted to name our keypair “wordpress-ssh” as it reflects what the downloaded file’s purpose is. You need to have a public/private key pair to login to your new hosted machine/instance. Click on the checkbox “I acknowledge that…” and click on “Launch instance”. Be patient while the instance launches.
On the next Launch Status page, click on the button to “View Instances”.
From your ‘Instances’ page, you should see your newly provisioned EC2 instance. Once the instance enters a ‘running’ state with a green icon, you’re ready to connect to it. Click on the button “Connect” to do so.
In the ‘Connect To Your Instance’ popup, Amazon provides various methods for how to connect to your new instance. Copy your ‘Public IP’ address and paste it somewhere. You’ll need it later. In our example image below, the IP address is
126.96.36.199. Your IP address will be different.
Great. You have now booted/started your machine instance. Let’s connect the domain name you registered on POP to your new web server by pointing DNS records at it.
Step 4: Add New DNS Records to POP for your new EC2 Instance
Now that you have saved the ‘Public IP’ address of your new Amazon EC2 instance, you’re ready to update your POP DNS records to point your domain at the EC2 Instance.
Navigate to the POP.co Simple DNS Editor located at https://pop.co/panel/service/simple-dns/.
If you have Simple Page enabled, you will need to turn it off. The same goes for any other third party hosting service. You don’t want to have overlapping DNS records for multiple web hosts.
Next, click on the “Advanced DNS” tab within the Simple DNS editor page. You’ll need to create two new records for your WordPress site:
Enter your IP address you copied from above here
Enter your root/naked domain name here (i.e. mysite.co)
Step 5: Setup WordPress on your new EC2 Instance
At this point, you have fully configured your Amazon EC2 machine. You can do whatever you’d like with it by simply SSHing in to the machine. While fully covering SSH is beyond the scope of this guide, we’ll point you in the right direction. To connect to a server with SSH, you will first need a client.
- Mac OSX includes the SSH client within Terminal by default.
- Windows do not come with an SSH client. We recommend downloading PuTTY.
- Linux distributions include support for SSH by default as well. Simply open up a terminal.
Once you have an SSH client, you need to connect to your new Amazon EC2 instance. Locate the path to the private SSH key file you downloaded earlier,
wordpress-vps.pem. You’ll need this file to SSH into the server. First, you need to give the file the proper permissions on OSX and Linux by typing the following:
sudo chmod 400 /path/to/wordpress-ssh.pem
Next, you need to connect to the server by issuing your SSH command using the private key file mentioned above. You’ll need the Public IP address of your new Amazon EC2 server which you should have copied earlier from the Amazon EC2 Dashboard. In our example below, our public IP address is 188.8.131.52. Replace this with your own.
ssh -i /path/to/wordpress-ssh.pem firstname.lastname@example.org
If you receive a message to confirm the authenticity of the host like below, either type ‘yes’ or simply hit the enter key to continue.
If all goes well, you will now be logged in to your Amazon EC2 instance console. To initiate your WordPress installation, we have scoured the web and created a script to help you automate as much of the setup as humanly possible. You will be asked for only three pieces of information during this setup process and it’s crucial that you enter them correctly and save the information in a safe place.
- A MySQL root user password.
- A MySQL wordpress user password.
- The domain name that you registered with POP.co. When entering a domain name, please leave out http://, http://www, and www. You are only being asked to enter the domain. Here some examples of correct domain names:
To initiate your server setup of WordPress, simply run the following commands, one per line:
cd /tmp sudo wget https://gist.githubusercontent.com/cballou/c3219856b5aab455264a/raw/72c12ce018c40c2a080f8a3aad3105ff4c594ee6/wp-install.sh sudo chmod +x wp-install.sh sudo ./wp-install.sh
After having supplied your domain and passwords, if you receive any popups or messaging during the process, just press enter to continue. It may take a few minutes to complete.
Upon successful completion of the LAMP server setup and WordPress installation, you will be notified with a success message. At this time, you can open your web browser and navigate to your .CO domain name to finish your WordPress setup. Once you fill out the information on the following screen and click “Install WordPress”, you’re done!
For the technically inclined, feel free to open the
wp-install.sh file in your favorite code editor to get a feeling for how WordPress was configured on your new machine. If you’re so inclined, you can optimize your WordPress install by setting up nginx as a reverse proxy as well as turning on a small, 1GB swapfile to keep your server chugging if you run out of memory during higher load. These two optimizations combined can scale your server to handle quite a bit of traffic on such a small machine instance.