2010-11-27-1

Amazon EC2 でインスタンスを作成する [aws]

Docs: Amazon EC2 (API Version 2010-08-31) を参考に、 OS: Ubuntu 10.04 LTS
Region: us-west-1
arch: 32-bit
root store: ebs
ami: ami-8c0c5cc9
の Micro Instance を作成します。
% ec2-add-keypair ec2-keypair > ~/.ssh/ec2-keypair.pem
% chmod 600 ~/.ssh/ec2-keypair.pem
% ec2-run-instances ami-8c0c5cc9 --instance-type t1.micro --region us-west-1 -k ec2-keypair
Client.InvalidKeyPair.NotFound: The key pair 'ec2-keypair' does not exist
とエラーになってしまいました。
% ec2-add-keypair --region us-west-1 ec2-keypair > ~/.ssh/ec2-keypair.pem
% ec2-run-instances ami-8c0c5cc9 --instance-type t1.micro --region us-west-1 -k ec2-keypair
でうまくいきました。
% ec2-describe-instances --region us-west-1
でインスタンスの状態が確認できます。 ssh で接続してみます。
% ec2-authorize --region us-west-1 default -p 22
GROUP default
PERMISSION default ALLOWS tcp 22 22 FROM CIDR 0.0.0.0/0
% ssh -i ~/.ssh/ec2-keypair.pem ubuntu@<external-host-name> The authenticity of host 'ec2-204-236-160-249.us-west-1.compute.amazonaws.com (204.236.160.249)' can't be established.
RSA key fingerprint is b8:02:c6:a3:6d:6c:f0:ed:c4:29:b6:39:12:36:0e:ff.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-204-236-160-249.us-west-1.compute.amazonaws.com,204.236.160.249' (RSA) to the list of known hosts.
Linux ip-10-160-119-84 2.6.32-309-ec2 #18-Ubuntu SMP Mon Oct 18 21:00:20 UTC 2010 i686 GNU/Linux
Ubuntu 10.04.1 LTS Welcome to Ubuntu!
 * Documentation: https://help.ubuntu.com/
 
 System information as of Sat Nov 27 06:44:16 UTC 2010
 
 System load: 0.0 Processes: 5 [長いので以降省略しました]