Help us understand the problem. What is going on with this article?

AWS CLI のメモ

AWS CLI のメモ

EC2起動

aws ec2 start-instances --instance-ids {instance-id}

EC2停止

aws ec2 stop-instances --instance-ids {instance-id}

SGルール表示

aws ec2 describe-security-groups --group-name {security-group-name}
aws ec2 describe-security-groups --group-ids {security-group-id}

SGルール追記

aws ec2 authorize-security-group-ingress --group-id {security-group-id} \
--ip-permissions '[{"FromPort": 80, "ToPort": 80, "IpProtocol": "tcp", "IpRanges": [{"CidrIp": "8.8.8.8/32", "Description": "abc"}]}]'

aws ec2 authorize-security-group-ingress --group-name {security-group-name} \
--ip-permissions '[{"FromPort": 80, "ToPort": 80, "IpProtocol": "tcp", "IpRanges": [{"CidrIp": "8.8.8.8/32", "Description": "abc"}]}]'

SGルールのDescription更新

aws ec2 update-security-group-rule-descriptions-ingress --group-id {security-group-id} --ip-permissions '[{"FromPort": 80, "ToPort": 80, "IpProtocol": "tcp", "IpRanges": [{"CidrIp": "1.2.3.4/32", "Description": "aaa"}]}]'

SGルール削除

aws ec2 revoke-security-group-ingress --group-id {security-group-id} --ip-permissions '[{"FromPort": 80, "ToPort": 80, "IpProtocol": "tcp", "IpRanges": [{"CidrIp": "1.2.3.4/32", "Description": "aaa"}]}]'

グローバルIP取得

curl https://checkip.amazonaws.com

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away