Create and Launch Amazon EC2 Instance (Ubuntu and CentOS)

Use Amazon Linux AMI (Compatible with CentOS)

In AWS Management Console -> Amazon EC2 -> Launch Instance


  • Basic 32-bit Amazon Linux AMI
    • Amazon Linux AMI Base 1.0, EBS boot, 32-bit architecture with Amazon EC2 AMI Tools.

Or Select

  • Basic 64-bit Amazon Linux AMI
    • Amazon Linux AMI Base 1.0, EBS boot, 64-bit architecture with Amazon EC2 AMI Tools.

Locate an Amazon EC2 AMI for other CentOS Distribution

Identify an EC2 AMI for CentOS

  • Go to (Registration and login required)
  • Browse for the latest created version
    For example
  • Select Import -> Clouds
  • Locate the AMI number for US-East

For 32-bit architecture on CentOS 5.4, use


For 64-bit architecture on CentOS 5.4, use


Locate an Amazon EC2 AMI for Ubuntu

Identify an EC2 AMI for Ubuntu

  • Go to and browse to the latest stable Ubuntu version
    For example:
  • Locate the AMI number for Region us-east-1 / 32-bit Ubuntu OS / Amazon EBS for the root device (boot partition)

For 32-bit architecture on Ubuntu 10.04, use


For 64-bit architecture on Ubuntu 10.04, use


Create & Launch an Amazon EC2 Instance

  1. Launch an EC2 Instance
    1. Go to & Sign in to the AWS Management Console
    2. Select Launch Instance -> Quick Start or Community AMIs
    3. Select the AMI or enter the AMI value found in previous step & hit enter
    4. Click Select on the AMI
    5. Select Launch Instance
      • Enable CloudWatch Monitoring for this instance
      • Enter "webserver" for your new key pair and Create & Download your Key Pair
      • Copy the generated webserver.pem file into c:\eng\dev\conf\aws
      • Select Create a new Security Group (A firewall configuration for EC2 instances)
        • Enter webserver for the name
        • Select HTTP and Add rule
        • Select HTTPS and Add rule
        • Select SSL and Add rule

Access Amazon EC2 instance in Windows using Putty

  1. Identify the public domain name for the EC2 instance
    1. In AWS Management Console, select Instances on the left panel
    2. Select the instance created
    3. In the bottom panel, locate the Public DNS value
  2. Download & install Putty
  3. Download Puttygen from the above site
  4. Generate a private key for the EC2 instance for Putty
    1. Run the puttygen executable
    2. In puttygen, click load
    3. Next to the File name box, select All Files and pick c:\eng\dev\conf\aws\webserver.pem
    4. (Optional) Enter a passphrase (Use as a password for the generated private key)
    5. Click Save private key
  5. Access EC2 Instance
    1. Run Putty
    2. Enter the instance Public DNS in the session
    3. Select Connection -> SSH -> Auth & click Browse
    4. Select c:\eng\dev\conf\aws\webserver.ppk
    5. Click Open
  6. For Ubuntu, login as "ubuntu" (Not "root")
  7. For CentOS, login as "root"

When an instance is stopped and restarted, a new public DNS will be assigned to the instance. Hence, you need to find the new DNS in order to login again.

Access EC2 Instance by ssh

Terminate/stop an EC2 Instance

Stop an instance will stop the billing of an EC2 instance

EBS charge still apply until the instance is terminated

  1. In AWS Management Console, select Instances in the left panel
  2. Right click on the instance to be stopped
    • Select stop to stop the instance
    • Use start to re-start the instance
    • Select terminate to delete the instance

Terminate an EBS based instance will

  • EBS volume attached before Instance Launch will be deleted by default
  • EBS volume attached after Instance Launch will NOT be deleted by default
  • Public and private IP will not be released
  • Elastic IP (if any) will be detached
  • Any local storage will be deleted when an instance is stopped/terminated

Difference between EBS based AMI and S3 based AMI

AWS has 2 kind of AMI which one used Elastic Block Storage (EBS) for the root device and one use a combination of S3 storage and local instance storage

Key differences:

  • EBS based AMI charge additional $0.10 per allocated GB per month and $0.10 per 1 million I/O
  • EBS can stop and restart without losing its storage data. S3 based AMI can only be terminated and all data will be lost
  • EBS based AMI boot up faster
  • EBS based AMI is easier to create
  • EBS storage is more reliable than local storage

Unless you are building a large cluster of web server which cost can add up fast, use EBS based AMI