AWS => awscli設定、動作確認

勉強メモみたいな感じになってきた。 まあコツコツやっていこうと思う。



# awscli インストール
pip install awscli

# バージョン確認
aws --version

# 設定
aws configure

# セキュリティグループ作成
aws ec2 create-security-group --group-name testgroup --description testgroup

# ポート解放
aws ec2 authorize-security-group-ingress --group-id hogehoge --protocol tcp --port 22 --cidr 0.0.0.0/0

# EC2 ログイン用キーペア作成
aws ec2 create-key-pair --key-name testkey

# インスタンス起動
aws ec2 run-instances --image-id hogehoge --instance-type t2.micro \
--security-group-ids hogehoge --key-name testkey --subnet-id hogehoge

# EIP 取得
aws ec2 allocate-address

# EIP 割り当て
aws ec2 associate-address --allocation-id hogehoge --instance-id fugafuga