1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

このセキュリティグループ使ってるの?

Last updated at Posted at 2025-05-16

前置き

AWSのデフォルトセキュリティグループはインバウンドルールもアウトバウンドルールもフル解放されており、使用しないことが推奨されています。
デフォルトセキュリティグループは削除できない仕様だったはずなので、AWS Configのルールでインバウンドルールを自動削除する設定をするのが望ましいと思います。

セキュリティグループが実際に使われているかを確認する

AWS CLIでEC2のReadOnly権限があれば、以下コマンドで確認することができます。

aws ec2 describe-instances --filters "Name=instance.group-id,Values=sg-xxx" --query "Reservations[*].Instances[*].[InstanceId,Tags[?Key=='Name'].Value|[0]]" --output table

※ValuesにはセキュリティグループIDを指定します

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?