Friday, August 5, 2011

Creating and connecting to first EC2 UNIX instance

Login to AWS EC2
Once you sign up or EC2 account, login to AWS management console.
Select EC2 tab

Create Key Pair
From the navigation panel on the left, navigate to Network and Security section
Click on Key Pairs
Create new Key Pair. Provide name of your choice (eg: kpn1). A key pair name will be created. Fingerprint will be displayed on the key pair panel. A file will be downloaded to your desktop named kpn1.pem

Create Security Group
From the navigation panel on the left, navigate to Network and Security section
Click on Security Group
Create Security Group (eg: Name: sg1, Description: Security Group 1)

Create EC2 instance
  1. From the navigation panel, go to EC2 dashboard
  2. Click on Launch Instance button
  3. If you want to start with a new instance to play, select Basic 32-bit Amazon Linux AMI 2011.02.1 Beta
  4. In the next page, select Number of Instances - 1, Availability Zone - no preference, Instance Type: Micro. These are the defaults. Leave as it is. Continue.
  5. Leave  the defaults on Advance Instance Options - Continue
  6. On the key value panel, type in the key as 'Name' and value as 'Web Server' (you can label it appropriately based on your server type). Continue
  7. Select 'Choose from your existing key pair'. Select the value  kpn1 from the dropdown. Continue
  8. Select Security group sg1. Continue.
  9. Click on Launch Instance. This step will create your EC2 instance.

Locating your EC2 IP
Navigate to Instances.
Select the server and review the bottom panel.
Public DNS: ec2-XX-XX-XX-XXX.compute-1.amazonaws.com
ec2-XX-XX-XX-XXX.compute-1.amazonaws.com is your hostname.
XX.XX.XX.XXX is  your IP address

Connecting to your EC2 Instance as ec2-user
ssh ec2-user@ec2-instance-ipaddress –i {filepath}/privkey.pem

or

1) Convert .pem to .ppk format using puttygen
Download puttygen.exe from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Execute puttygen
File -> Load Private Key -> Select kpn1.pem
You will get a prompt successfully imported foreign key.
File -> Save Private Key -> Save as kpn1.ppk

2)
Download putty.exe from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. This is a tool to connect to your ec2 unix instance.
Execute putty.exe
Session -> Host Name -> Type ec2 instance ip address
Navigate to Connection -> SSH - Auth -> Select the kpn1.ppk file
Open

3) Login as ec2-user

Connecting to your EC2 Instance as root
You still have to follow the steps to login as ec2-user
and then type command "sudo su"

Sunday, July 31, 2011

Change the time in EC2 instances

1) Backup /etc/localtime
2) ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Saturday, July 30, 2011

Sign up

Sign up for Amazon AWS.

Setting up a website in AWS require planning and decision making.

Try to understand the pricing model.