5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【AWS】全世界に公開しているサーバがないかチェックするバッチ

Posted at

AWSのセキュリティグループ設定でサーバを全世界に公開してしまって、ウイルス感染することがあったので、EC2-CLIを使って監視バッチ(Windows)を作成。
自PCから毎日起動で少しだけ幸せになれる、かも。

ec2-security-check.bat
rem Javaの設定
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_65
set PATH=%PATH%;C:\ProgramFiles\Java\jdk1.7.0_65\bin

rem EC2 CLIクライアントのインストールディレクトリの設定
set EC2_HOME=C:\ec2-api-tools-1.7.1.0
set PATH=%PATH%;C:\ec2-api-tools-1.7.1.0\bin

rem EC2 CLIの接続設定(東京リージョン)
set EC2_URL=https://ec2.ap-northeast-1.amazonaws.com
set AWS_ACCESS_KEY=[アクセスキー]
set AWS_SECRET_KEY=[アクセスパスワード]

rem セキュリティグループの確認

ec2-describe-group [セキュリティグループ] | findstr -i FROM | findstr -i 0.0.0.0

pause
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?