Establishing and improving the website for Champlin Technologies LLC has been a rewarding learning experience. This website has gone through a few major reincarnations using various web-dev tools and webhosts. The original website for Champlin Technologies LLC was dirt simple and hosted with a popular webhost service that didn’t deliver on two important metrics: load-time (over 12 seconds for initial load time for home page) and up-time (down for several hours each month).
This website is currently hosted with Amazon Web Services (AWS) with the following observations:
- Performance is now quick (load time is less than 1 second for first view, less than 0.4 seconds for repeat views).
- Availability is unbelievably impressive.
- Solution is affordable.
As I can affirm, establishing a website on AWS EC2 can be a little intimidating at first to setup, configure, backup, and operate … even for people with good Linux and IT skills. Fortunately, effective help is just a few clicks away. This post is the first of a 5-post series with step-by-step procedures that I followed recently to setup WordPress on AWS for this version of the website. As such, this post provides a detailed procedure for me to reuse and for others to reference. I am an advocate of incremental testing – confirming success at intermediate points in a multiple-step complex process.
Note: The Champlin Technologies LLC website is a simple low-maintenance website with low visitor count. Installation and configuration are easy. I will most likely seek the support of experts if I want to establish a sophisticated website that handled commerce or significant traffic with lots of site visitors.
This website will have the following configuration:
- Host: AWS EC2
- Instance: ‘t2.small’ (1 CPU, 8 GB mem), Ubuntu 16.04 with 8 GB storage
- Stack: LAMP
- Website: WordPress with Avada from ThemeFusion
- AMIs: LAMP with initial WP, Fully configured CTLLC (3 month rotation)
From a site maintenance perspective, I will capture an Amazon Machine Image (AMI) of the ‘t2.small’ instance immediately after the initialization of WordPress. That way, I can quickly (in a few minutes) create a new ‘t2.small’ instance and restore this image to get the LAMP stack with a plain vanilla WordPress installation up and running in a few minutes without going through the installation procedures written below.
If an AWS account needs to be established, then follow go to Amazon Web Services (AWS), click on ‘Sign in to the Console’, and follow the steps to create an account.
Launching an AWS Ubuntu Instance:
To create a new instance, sign into AWS and click on ‘EC2’ from the list of services on the AWS dashboard, then click on ‘Instances’ from the left column on the EC2 Dashboard. The screenshot shows a portion of my EC2 dashboard with two running instances and a stopped instance. To create a new instance, start by clicking on ‘Launch Instance’.
- Choose an Amazon Machine Instance (AMI): I usually select the ‘Ubuntu Server 16.04 LTS (HVM), SSD Volume Type’, 64-bit AMI.
- Choose an Instance Type: For this website, I selected the t2.small instance. It has one virtual CPU, 2 GB of RAM. Then, click on ‘Next: Configure Instance Details’.
- Configure Instance Details: I usually accept the defaults at this step and click on ‘Next: Add Storage’.
- Add Storage: This website is consuming approximately 2.5 GB. Since 8GB is the standard amount of storage, I usually accept the defaults at this step and click on ‘Next: Tag Instance’.
- Tag Instance: In the screenshot above, my three instances are named. This is the step where the instance can be named. Note that after the instance is created, the name can be changed at any time from the EC2 dashboard by clicking on the magic pencil in the name field of an instance. Then, click on ‘Next: Configure Security Group’.
- Configure Security Group: Create a new security group (e.g., example-security-1) and add the following rules to this new security group, then, click on ‘Review and Launch’:
- If the instance is not eligible for the free tier usage, there will be a notice about that fact at the top of the screen. Otherwise, review the configuration summary and click on ‘Launch’. This is the key step (pun intended) in the launch process. SSH access to the AWS instance is not with a password but with a public/private encryption key pair. Select ‘Create a new key pair’, type in a relevant filename (e.g., example_ami_key) and click on ‘Download Key Pair’.
- The private key is sent to the Mac OS ‘Downloads’ folder with the following filename: ‘example_ami_key.pem.txt’. Edit the filename to remove the ‘.txt’. Accept the filename suffix change dialog box notification:
- Then, move the file to the .ssh folder using ‘Terminal’ using the following command and restrict permissions with the second command:
mv ~/Downloads/example_ami_key.pem ~/.ssh chmod 400 ~/.ssh/example_ami_key.pem
- At this point, go back to the key pair dialog box and click on ‘Launch Instances’. Going back to the EC2 dashboard as shown in the first screenshot, a new instance will start initializing. After a few minutes, it will be running as shown in the following screenshot:
- Now for the final step – accessing the instance via SSH. Two pieces of information are needed and available from the EC2 dashboard: filename for the key and public DNS. Note: I am using the filename key and public DNS from this example. Using this information, enter the following command to access the instance as ubuntu (default user), with appropriate changes based on your key filename and DNS, into the Mac OS ‘Terminal’:
ssh -i ~/.ssh/example_ami_key.pem email@example.com
- On first launch, the AWS instance may ask to verify. Type Yes and return. A successful login screen will look similar to:
- Type ‘exit’ to quit the SSH connection.
Setting up an Elastic IP Address for DNS:
An Elastic IP address (i.e., static public IP for the website) is needed to associate a website name via a DNS (domain name service). Click on the ‘Elastic IPs’ topic located on the left column of the EC2 dashboard. Then, click on ‘Allocate New Address’ and confirm the allocation request. An Elastic IP address is immediately allocated.
Associate the Elastic IP address (e.g., 220.127.116.11) to the instance by highlighting the address and selecting ‘Associate Address’ from the ‘Actions’ pull-down menu. Click in the ‘Instance’ field, associate the instance (e.g., Example 1), and click ‘Associate’.
At this point, a static IP address (e.g., 18.104.22.168) is our website’s IP address. Open a new Terminal window and enter the following command with the new Elastic IP address (confirm ‘yes’ on initial login using this IP):
ssh -i ~/.ssh/example_ami_key.pem firstname.lastname@example.org
Use a DNS service to assign a website name to this new IP address. After that DNS website name is established, the website name can replace the IP address in the above command.
That’s it. A Linux instance has been established, SSH access works, the Elastic IP address works, and the DNS web name works as an address.