LoginSignup
3
0

More than 3 years have passed since last update.

AWS CLI でセキュリティグループの詳細を参照する (EC2 Classic, VPC, RDS)

Posted at

株式会社オズビジョンのユッコ (@terra_yucco) です。
今日はライトに、今日の業務で直面した AWS CLI コマンドを。

AWS CLI でセキュリティグループの詳細を参照する方法

EC2 Classic のセキュリティグループ

  • セキュリティグループ名で参照可能
aws ec2 describe-security-groups --group-names <sg-name>

EC2 VPC のセキュリティグループ

  • セキュリティグループ ID で参照可能
aws ec2 describe-security-groups --group-ids sg-<sg-id>

RDS のセキュリティグループ

  • コマンド、引数とも微妙に異なる
aws rds describe-db-security-groups --db-security-group-name <sg-name>

AWS CLI マニュアルを読んでみる

【】内は訳する際に補ったものとなります。

aws > ec2 > describe-security-groups

Synopsis (要約)

  describe-security-groups
[--filters <value>]
[--group-ids <value>]
[--group-names <value>]
[--dry-run | --no-dry-run]
[--cli-input-json <value>]
[--starting-token <value>]
[--page-size <value>]
[--max-items <value>]
[--generate-cli-skeleton <value>]

--group-ids (list)

The IDs of the security groups. Required for security groups in a nondefault VPC.

Default: Describes all your security groups.

--group-ids (list)

セキュリティグループの ID。デフォルトでない VPC 内のセキュリティグループ【を特定する場合】において必要。
デフォルト【未指定】ではすべてのセキュリティグループを詳細表示する。

--group-names (list)

[EC2-Classic and default VPC only] The names of the security groups. You can specify either the security group name or the security group ID. For security groups in a nondefault VPC, use the group-name filter to describe security groups by name.

Default: Describes all your security groups.

[EC2-Classic 及びデフォルト VPC のみ] セキュリティグループの名称。セキュリティグループの名称と ID どちらも指定可能。デフォルトでない VPC 内のセキュリティグループに対しては、セキュリティグループ名で詳細表示したい場合には group-name フィルタを利用する。
デフォルト【未指定】ではすべてのセキュリティグループを詳細表示する。

整理

VPC --group-names --group-ids
Classic 指定可能 指定可能
Default VPC 指定可能 指定可能
Non-default VPC 指定不可能 指定可能

aws > rds > describe-db-security-groups

Synopsis (要約)

  describe-db-security-groups
[--db-security-group-name <value>]
[--filters <value>]
[--cli-input-json <value>]
[--starting-token <value>]
[--page-size <value>]
[--max-items <value>]
[--generate-cli-skeleton <value>]

--db-security-group-name (string)

The name of the DB security group to return details for.

--db-security-group-name (string)

詳細を知りたい DB セキュリティグループの名称。

Conclusion

業務で特定のリソースへのアクセス権限を調査していたのですが、同じ Security Group という言葉でも調べ方からして異なっていて困ったので、自分用にメモをしました。

3
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
3
0