Setup a Personal Server on Amazon Web Services

I have been managing Linux Virtual Servers for well over 10 years. I visited the AWS offering many times before taking the plunge. Their huge variety of server options, storage options, bandwidth options, etc made their offering very confusing. Since I did not understand which options I would need, I could not determine what costs to expect. Let’s review the total cost associated with a small Debian server on AWS and walk through setup of that server.

Costs

Server (EC2 t2.micro w/ 1GB ram):  $162 ($109 initial + $1.46/mo)
Storage (EBS SSD 30GB): $108 ($0.10/GB/MO)
Outgoing Bandwidth (540GB): $49 ($0.09/GB)
Incoming Bandwidth: FREE
Static IP (Elastic IP): FREE
TOTAL 3-YEAR COST:  $319  ($109 initial + $5.83/month)

AWS offers a free tier that provides all new customers with the server/storage/bandwidth configuration shown above one (1) full year.

Personal Setup Instructions

  1. Create a new AWS account and login to the account.
  2. Drill-down to the EC2 services control panel.
  3. Click “Launch Instance”
    1. Choose an Amazon Machine Image (AMI) – This is a prebuilt OS image. I typically go to the “Community AMI” page, search for “Debian amd64 hvm”, and click “Select” next to the most recent AMI listed.
    2. Choose an Instance Type – These are your server specs. Let’s choose the smallest (cheapest) instance type, currently “t2.micro” with 1 CPU and 1GB of RAM. Click Next.
    3. Configure Instance Details – “Enable Termination Protection” should be enabled, to protect your instance from accidental “Termination” (deletion). The rest of the default settings are fine for now. Click Next.
    4. Add Storage – Configure your server disk size here. By default, disk size currently defaults to 8GB on a General Purpose (SSD) drive. Increase the disk size if you’d like, otherwise accept defaults and click Next.
    5. Tag Instance – We will not create any tags. If you use AWS for multiple customers or projects, you can use tags to classify resources by customer, by project, etc. which can be helpful for billing and overall management.  Click Next.
    6. Configure Security Group – This page allows you to create basic firewall rules. By default, you will create a new security group allowing SSH access from ANY IP. Accept the default for now and click Next. You can easily edit your Security Groups (firewall rules) later.
    7. You have an opportunity to review your settings. Click Launch.
    8. Key Pair – Create a new SSH key pair and download the keys. You will use this SSH key pair (instead of an SSH password) to login to your AWS server.  Click Next.
    9. Congrats!  AWS is building your new server!  The server should be ready for use in less than a minute.
  4. Go back to the AWS console, drill-down to EC2, and click on “Instances”. Your new server should be listed. Click on your new server to view server details, including “Public IP”
  5. SSH into your new server!
    1. GUI – If you are using a GUI such as PuTTY, the SSH hostname will be the “Public IP” (e.g. 10.9.8.7) shown in your server details and the username for your Debian server should be “admin”.  Be sure to tell the GUI to login using your private key.
    2. CLI – Assuming “Public IP” is “10.9.8.7” and you saved your SSH key to “private.key”, you would run the following command:  “ssh -i private.key admin@10.9.8.7”
  6. Update your Debian OS (e.g. “sudo apt-get update” and “sudo apt-get upgrade”)
  7. Oops! The OS cannot access the internet! You need to allow outbound traffic in your Security Group. Let’s edit your outbound firewall rules…
    1. Go back to the AWS console, drill-down to EC2, and choose “Security Groups”
    2. Click on your existing Security Group in the upper window pane, click on the “Outbound” tab in the lower window pane, and Add Rule to allow “All Traffic” to “Anywhere”. Click Save. Changes should take effect almost instantly (less than 5-10 seconds).
  8. Try to update your Debian OS again.
  9. You should be good to go at this point!

Reserved Instances

After your free year of service has ended, You need to decide which Instance size you plan to use (e.g. “t2.micro” or “t2.small”) and purchase a “Reserved Instance” (RI) for that Instance size to help keep your costs down. You are essentially pre-paying part of your hourly fee for 1 or 3 years in exchange for either a 30% or 50% discount, respectively.You do not link an RI to a specific instance. As long as you have an instance type running in the same “Availability Zone” (AZ) as the RI instance type and RI AZ, you will automatically receive the discounted hourly rate.

Amazon allows you to resell the unused months of your RI in their marketplace and recoup nearly all of the unused value (e.g. pay $109 for 36-mo “t2.micro” RI, receive around $50 if you sell 18-mo “t2.micro” RI on the market).