Created
April 4, 2018 07:48
-
-
Save GitSumito/8572f1d06390386466758418498bc0ed to your computer and use it in GitHub Desktop.
AWSセキュリティグループ設定をコマンド(aws-cli)でやる ref: https://qiita.com/S-T/items/3d4197bbed1022ccac43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VpcId="vpc-12345678" | |
NewGroup="application.stg.sg" | |
aws ec2 create-security-group --group-name ${NewGroup} --description "${NewGroup}" --vpc-id ${VpcId} --description "${NewGroup}" > create-security-group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 人間が見やすいフォーマット | |
aws ec2 describe-security-groups --group-id ${GroupID} --output table | |
# json | |
aws ec2 describe-security-groups --group-id ${GroupID} --output json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws ec2 authorize-security-group-ingress --group-id ${GroupID} --protocol tcp --port 8081-8082 --cidr 10.0.0.1/32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws ec2 revoke-security-group-ingress --group-id ${GroupID} --ip-permissions '[{"IpProtocol": "tcp", "FromPort": 8081, "ToPort": 8082, "IpRanges": [{"CidrIp": "10.0.0.1/32"}]}]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment