0
0

More than 1 year has passed since last update.

カフェに入ったらsshのグローバルIPでAWSのSGを開けれるシェル

Last updated at Posted at 2022-01-03

前提

awsの権限はすでに設定されている前提
aws configure叩いたらこんなのが出てくるし、権限も充分に付与されている状態

 aws configure
AWS Access Key ID [*******************T]: 

sh

ip=$(curl -s httpbin.org/ip | sed -n -e "s/.*: .\(.*\).$/\1/p")
port 22 --cidr $rtn/32)
#なんかもっとかんたんな気もする👆
aws ec2 authorize-security-group-ingress --group-id あなたのSG --protocol tcp --port 22 --cidr $ip/32

image.png

後記

これを叩きまくるとSGがmaxに到達するのでそのときの削除はバッチ処理してください...orz
->この上限があがったかもしれません

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0