Beginners guide to Amazon Cloud

Everybody heard about Amazon Cloud. It has been around for a good few years. Despite its popularity not everybody had a chance to try it. Amazon tries it best to get more people on board by offering “Micro” versions of their web service for free. If you are into technology or just want a quality hosting for your website, it’s worth getting familiar with AWS. After all.. can you beat free?

First you have to create an account. Go to http://aws.amazon.com/ and register. Once you have an account, login and go to “AWS Managment Console”. The link is available under “My Account / Console” tab.

AWS Services

Whooa… that’s lots of products. Don’t worry, it’s not that complicated as it looks.

To install your software on Amazon you need a server. Choose EC2 from Compute & Networking section. In the realm of cloud computing servers are called instances. Click on “instance” from left hand side navigation. You should see something like on the below image (obviously your instances list should be empty).

EC2 List

To create a new instance click on a big button called “Launch Instance”. That should bring a JavaScript modal.

EC2 Create

Stay with the “Classic Wizzard” and click continue.

EC2 Distribution

Now it’s getting interesting. On this screen you are asked to select your distribution. My choice is 64bit Ubuntu but it’s just a personal preference. Before we go any further have a quick look on “My AMIs” tab. After you launch and setup your instance you can create an image from it. Later when you will require more computing power you can fire new instances from the image. Very cool, isn’t it? Select your distribution and go to the next step.

EC2

Now you have to select instance type. Go for the first option called T1 Micro. Make sure it says “Free tier eligible”. Click continue.

The next step is called “Advance Instance Option”. There is nothing you want to change there. Click continue. The same on “Storage Device Configuration” and on another page.

EC2 Keys

At this step you have to create a key pair. You will need it to login into your EC2 instance. If you are new to SSH keys you can find more details here. Always protect and backup keys. You can’t download them from Amazon and you can’t regenerate them for running instance. If you lose it you won’t be able to login. I learned it the hard way.

The next step is to select security group. It allows you to open / close certain ports on your server. You can go for the default option and edit the group later.

That’s it. The last screen is summary of your settings. If you are happy with everything click on “Launch” button.

EC2 Address

To find out what is the address of your instance select it from the list. It should be something like “ec2-54-246-44-13.eu-west-1.compute.amazonaws.com”. If you are on Linux or Mac you can login immediately.

$ ssh -i path/to/key.pem ubuntu@you-address

Windows users need to convert the .pem key to format compatible with putty. Dowload PuTTYgen.exe, open it and select “Convertions > Import key”. Chose your Amazon key. Once the file is loaded select “File > Save private key”. Password protection is optional, you don’t have to do it. After that step you are ready to load the key with Putty Agent. If you don’t have it download pageant.exe from Putty website. Run pageant.exe and load the key. Now you can open Putty and login to your EC2 server.

If you plan to use the instance as a web server create a load balancer. One load balancer is free and it’s practical to use it. If for any reason you will have to stop your server IP address will change. It means you will have to change domain settings and wait 24h for propagation… not good. This is another thing I learned the hard way. It’s also better to have it ready in case you have to scale.

Click on “Load Balancers” on the left hand side navigation. It’s under “Network & Security” section. Click on “Create Load Balancer” button. It’s very easy setup. Just chose a name and go to step 3.

EC2 Load Balancer

On this screen you have to specify which instances should be use with the load balancer. At this stage you should have only one item. Select it and click continue.

EC2 Load Balancer

When you finish with configuration click on your load balancer. You will find notes which explain what is the best way to setup your domain.

Micro instance is good enough for a web server but might get slow with a database. For a database you might chose RDS. Go back to Amazon Web Services list by clicking on cube in the left top corner. Look for RDS under Database section. Click on DB Instances and then on Launch DB Instance button.

RDS

After selecting database engine pay attention to DB Instance Class settings. If you don’t want to pay for it select t1.db.micro and minimum storage size.

Using RDS is not require. You can fire another EC2 instance and set everything manual. The advantage of using RDS is free backups (to a certain level) and easy configuration.

I keep database and web server on the same EC2 instance. It wouldn’t survive the traffic it has without Varnish Cache. You can read about it here.

If you want to have multiple web servers you need to think how are you going to share use session. You can install memcached on each of your web servers or use ElastiCache.

ElastiCache is another service under Database section. There isn’t much more to say about it. Just be aware it’s there and you can use it.

This post covered basics of working with AWS however it should be enough to run a medium size website. Using Amazon is easy and fun. Number of features might be intimidating at the first glance but after few minutes it all start to make sense.

Some useful links to help you find out more about pricing and setups:

AWS Free Usage Tier
EC2 hardware configurations
EC2 pricing
RDS pricing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s