Thursday, March 1, 2012

Some notes about getting started with Amazon AWS

I'm a noob in regards to AWS. Some of my notes here for a friend who will be using the AWS for his website. Please correct me if I'm wrong...


For a start, creating an instance is getting a machine for use. Going through the creation of a new instance (with the classic instance):
  • you need to choose a AMI (Amazon Machine Image). Basically it's a choice of operating system you need. In my case, I choose Amazon's Linux AMI (it's based off CentOS anyways).
  • choose the instance type. I'm a cheapo trying out the free tier - so it's a Micro instance for me. I have no preference for the availability zone.
  • I'll just have the default Kernel ID and RAM Disk ID. Tags (Key and Value) for the instance I'll just leave it blank for now.
  • Creating key pair if you don't have any that you want to use. It's important to (download and) keep the private key, as you will need it later on.
  • Configure security group. It's about the firewall policy for the machine. As I want just the Apache server service to be facing the internet, I'll just create a new security group and then add the Rule for SSH and HTTP. I'll just leave the source as it is for now (0.0.0.0/0)
  • Launch!

Other notes:

By default the public DNS for your instance is something like: ec2-somenumbers.ap-southeast-1.compute.amazonaws.com. If you prefer a nice public IP, you can get the Elastic IP:  
  • Allocate a new address
  • then associate the address with your instance
Note that you will need to pay if the address you obtained is not associated with any instance.
The Route 53 service is for more complicated use case. :)


Connecting to the instance when you got a Windows computer:
  • Grab the PuTTY and PuTTYgen software
  • PuTTYgen is needed cos you need to convert your private key (myprivatekey.pem) to a format which PuTTY can use
  • PuTTY to connect to your instance thru SSH
  • You can use Filezilla to connect (and upload files) to your instance. Need to add keyfile thru Edit > Settings > Connection > FTP > SFTP

To update the system and install the Apache and php:
sudo yum update
sudo yum install httpd php
The root folder for the website is in /var/www/html . You should be able to see a sample landing page at your instance's public DNS address.
Check out CentOS documentation/guides if you wanna do anything else which you are unsure of.


Persistent Storage:
Creating the instance (with Amazon's Linux AMI) would also create a 8GiB volume in the Elastic Block Store (EBS). This volume would be GONE if you terminate the instance. If you want something a more permanent store (other than S3), you can:
  • Create new volume
  • Attach the new volume to your running instance, which it will appear as /dev/sdX in the instance
  • which then i would use fdisk to create partition, mkfs for the filesystem, then mount it.
  • Edit /etc/fstab if you want the partition to be auto-mounted on start.
For the free tier, you have 30GiB of EBS to play around.


ElasticFox is pretty cool extension for Firefox. You need the credentials in order to access your aws panel. Citation: http://manavg.wordpress.com/2010/12/27/amazon-ec2-and-elasticfox/

That's it for now I guess.

No comments:

Post a Comment