* EC2 [#c97e86a6]

** キーペア作成 [#g6ef38e1]

 $ aws ec2 create-key-pair --key-name my-keypair-01 --query 'KeyMaterial' --output text > my-keypair-01.pem

- http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2-key-pairs.html
- http://docs.aws.amazon.com/cli/latest/userguide/cli-ec2-keypairs.html

** インスタンス作成 [#eff8e037]

 $ export AWS_DEFAULT_REGION=ap-northeast-1
 $ aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t2.micro --key-name my-keypair01 --security-groups my-sg-name-01

- http://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html
- http://dev.classmethod.jp/cloud/aws/awscli-ec2-1-instance/

*** 接続確認 [#v918698f]
 $ ssh -i my-keypair01 -l ec2-user 50.100.200.300

** インスタンス停止 [#r525bf61]

 $ aws ec2 stop-instances --instance-ids i-xyz789 i-abc123

http://docs.aws.amazon.com/cli/latest/reference/ec2/stop-instances.html

** インスタンス終了 [#p5867b61]
 $ aws ec2 terminate-instances --instance-ids i-xyz789 i-abc123

http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/terminating-instances.html
- http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/terminating-instances.html
- http://dev.classmethod.jp/cloud/aws/awscli-ec2-1-instance/

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS