Compression is particularly important on Amazon Web Services (AWS) because:
HTML is very redundant and bulky
Smaller files are sent to the client faster
AWS charges you based upon OUTPUT bandwidth; smaller files = less bandwidth usage per file
Simple activation of mod_deflate
These instructions assume you have already setup an AWS instance and have an SSH client (like PuTTY) available and a SCP client (like WinSCP) to use when editing the configuration files.
Log in to your instance via the SCP client then open the apache2 virtual hosts configuration file (“/etc/httpd/conf.d/vhosts.conf” for the default setup mentioned in other instructions here).
Add the “AddOutputFilterByType DEFLATE text/html text/plain text/xml” Filter to each virtual host (virtual hosts are the groupings starting with “<VirtualHost “). You should inclose the filter in a conditional module statement (“<IfModule xxxx.x>”) to make sure your web server keeps running even if you happen to remove the deflate module.
Save the virtual hosts configuration file.
Open the SSH client and transfer to the root user (“sudo su”)
Restart the apache2 service (“service httpd restart”).
The changes to the virtual hosts configuration file
Amazon AWS is currently offering a ‘free tier’ for 1 year. Simply you get a micro instance to get your server up and running, play with different settings and such. It is the standard free trial offer, but with a virtual server. If you’ve never used AWS before, I recommend using the free tier server to get acquainted with the capabilities of AWS then move to a real server later. Also, once you have all the settings working on the free tier instance, you can transfer to paid instance in 15 minutes.
AWS Free Tier
750 hrs/month Micro instance (613 MB of RAM, Linux or Windows)
750 hrs/month Elastic Load Balancer (15 GB of data processing)
Click on “EC2” under the Compute & Networking section. (Note you may have to choose your region at this point if it hasn’t been setup yet.)
At the “Amazon EC2 Console Dashboard” there should be a button in the middle of screen called “Launce Instance”, Click it.
The wizard will pop-up asking you to choose a type of wizard. Select “Class Wizard” and click “Continue” at the bottom right.
Select the “Amazon Linux AMI ####.##” AMI. It should be the top option under the “Quick Start” tab. Note, you can use any of the AMIs with a yellow star next to the select button for the free tier. The 32-bit version will be slightly easier to deal with later, but 64-bit version works just fine also.
You will now need to determine the basic instance details. For the free tier, make sure the “Number of Instances” is set to 1 and the “Instance Type” is “Micro (t1.micro, 613 MiB)”. The “Availability Zone” doesn’t matter right now so “No Preference” is fine. Click the “Continue” when the settings are correct.
You now can determine some of the advanced options. The only thing you need to be concerned about is the “Shutdown Behavior” which should be set to “Stop”. Click the “Continue” when the settings are correct.
The next page is a the storage details. New instances default to a “Root Volume” which is effectively a new blank standard EBS volume.I recommend you uncheck the “Delete on Termination” checkbox to prevent you from accidentally erasing your data when the instance dies.Click the “Continue” when the settings are correct.
Now you can set metadata you want to correspond with this instance. These key/value pairs will help with searching and administrating large clouds of multiple servers. In addition to the “Name” key, we generally always place a “admin” key with the value equaling the programmer who administrates the instance. You can place up to 10, and you can always change them later. Enter something for the “Name” key’s value then press “Continue”.
The next step is absolutely essential to run a secure instance and have access via an SSH client. Instead of using usernames and passwords, AWS uses usernames and encryption keys, called “Key Pairs.” This encryption level prevents brute force attacks against your instance. Enter a name (alphanumeric without spaces) then press the “Create and Download your Key Pair” button. You will be expected to save the key file somewhere on your locale computer; remember where because you will need this file later when setting up your SSH and SCP clients. Click “Continue” once you have created your Key Pair.
The last setting you need to determine is the firewall. Amazon allows you to create an off-instance firewall to limit access to your instance. Click on the “Create a New Security Group” radio button then enter a “Group Name” and “Group Description”. Leave the the “Inbound Rules” empty for now. Typically when you create an instance, you will you use a pre-created security group that you already setup for the purpose of the instance. Click “Continue” once the new security group is created.
This last page is just a review of the settings for your new instance. Look over them and make sure everything is correct then click “Launch.” A few moments later your simple Free Tier instance will be up and running. The next step is getting access to it, then installing software and configuring everything. These will be discussed in future posts.