Howto launch Ubuntu Server 14.04 LTS on Amazon EC2

Vinzenz Weber
3 min readAug 13, 2016

--

Whenever I have a business idea I’d like to test or just want to play around with new Meteor features, I launch an EC2 instance running Ubuntu to deploy my Meteor app. This blog post basically covers my checklist.

1. Launch an EC2 instance
I am launching Ubuntu Server 14.04 LTS on a t2.nano instance. This instance type is great for testing out new simple web based business ideas due to its low cost of roughly $5,48 per month on an hourly basis. You could even get the price down to only $2,50 per month if you are purchasing a Reserved Instance for 3 years.

2. Configure your security group
Make sure you add rules for HTTP, SSH and HTTPS. Use the “My IP” option in the select box for SSH and always make sure SSH is only available from your work place so nobody can easily hack your server. On the other hand forgetting to update this IP address is my most common mistake, if I can’t log into my machine when changing my work place.

3. Select an existing key pair or create a new one
In case you create a new key pair, make sure you copy that pem file to a secure directory. I am using a Mac and store my keys in ~/.ssh . Do not forget to change your new key’s file permissions, otherwise you won’t be able to ssh into your server instance:

chmod 400 ~/.ssh/keypair.pem

4. Connect to your instance
Just to make sure you properly setup your server, ssh into it using either your instance’s public IP or public DNS. I prefer using the IP, simply because it is shorter:

ssh -i ~/.ssh/keypair.pem ubuntu@51.57.70.106

5. Allocate an Elastic IP (Optional)
You are probably going to stop and start your EC2 instance during development either to save a little bit of money or due to some other necessity. Whenever you restart an instance, it will be assigned another public IP address. To avoid updating your application settings or your A records on your DNS server whenever you reboot your instance, I recommend you allocate an Elastic IP which will always stay the same and you will be able to reassign it to any of your running EC2 instances easily.

6. DNS records (Optional)
In case you want to run a public web application on your server and/or use SSL you must register your own domain. Therefore you will have to add A records to your DNS server linking your Elastic IP to your domain. I usually add three records. In case you are only setting up a subdomain of some other domain you already own, you will obviously only add a single record.

Next steps
I usually register a free (at no cost that is) SSL certificate in the next step. Read my next post to see how I do it. Otherwise you are ready to deploy an application to your EC2 instance now.

--

--