http://docs.amazonwebservices.com/AWSEC2/latest/CommandLineReference/
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&categoryID=88
export JAVA_HOME=<java path>/Home export EC2_HOME=<your ec2-api-tools (root directory)> export EC2_REGION=ap-southeast-1 export EC2_PRIVATE_KEY=<your path>/pk-xxxxxxxxxxxxxxxx.pem export EC2_CERT=<your path>/cert-xxxxxxxxxxxxxxxx.pem export PATH=$PATH:$EC2_HOME/bin
// Check $ ec2ver
$ ec2-describe-regions
// Output (101003) REGION identifier Region name Service endpoint to which you make requests
// Example (101003) REGION eu-west-1 ec2.eu-west-1.amazonaws.com REGION us-east-1 ec2.us-east-1.amazonaws.com REGION us-west-1 ec2.us-west-1.amazonaws.com REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com
$ ec2-describe-images [地域を指定 --region <region type e.g. ap-southeast-1>]
// Output IMAGE identifier (IMAGE) ImageID (ami-xxxxxxxx) Manifest location (98xxxxxxxxxx/<bucket name>) ID of the AWS account that registered the image (98xxxxxxxxxx or "amazon") Image status (available, pending, failed) Image visibility (public or private) Image architecture (i386 or x86_64) Image type (machine, kernel, or ramdisk) Type of root device (ebs or instance-store) Virtualization type (paravirtual or hvm)
$ ec2-describe-group [地域を指定 --region <region type e.g. ap-southeast-1>]
// Output Output type identifier ("GROUP", "PERMISSION") AWS account ID of security group owner Security group name Description if identifier is "GROUP" Firewall rule if identifier is "PERMISSION"
// Example GROUP 98xxxxxxxxxx default default group PERMISSION 98xxxxxxxxxx default ALLOWS tcp 80 80 FROM CIDR 0.0.0.0/0
$ ec2-describe-keypairs [地域を指定 --region <region type e.g. ap-southeast-1>]
// Output KEYPAIR identifier Key pair name Private key fingerprint
// Example KEYPAIR <key pair> 81:8f:xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx;xx
$ ec2-run-instances <ImageID e.g. ami-xxxxxxxx> -g <group name> -t <Instance type e.g. m1.small> -k <Key pair> [<地域を指定 --region <region type>]
// Example RESERVATION r-a21827f0 98xxxxxxxxxx default INSTANCE i-xxxxxxxx ami-xxxxxxxx pending 0 m1.small 2010-10-02T23:56:37+0000 ap-southeast-1b monitoring-disabled instance-store
$ ec2-describe-instances [インスタンスを指定 i-xxxxxxxx] [地域を指定 --region <region type e.g. ap-southeast-1>]
// Example RESERVATION r-c7055795 986661948336 default INSTANCE i-xxxxxxxx ami-xxxxxxxx ec2-175-41-xxx-x.ap-southeast-1.compute.amazonaws.com ip-10-128-xx-xxx.ap-southeast-1.compute.internal running <key pair> 0 m1.small 2010-07-07T17:04:07+0000 ap-southeast-1b monitoring-disabled 175.41.xxx.x 10.128.xx.xxx instance-store paravirtual
$ ec2-terminate-instances <InstanceID e.g. i-xxxxxxxx> [地域を指定 --region <region type e.g. ap-southeast-1>]
// Output INSTANCE identifier The instance ID of the instance being terminated The state of the instance prior to being terminated The new state of the instance
// Example INSTANCE i-xxxxxxxx running shutting-down