Security Groups

 

 

 


Usage

 

基本

aws ec2 describe-security-groups [--filters <value>]

aws ec2 describe-security-groups > sg.json

 

進階

[--filters <value>]

 * If using multiple filters for rules, the results include security groups for which any combination of rules

  • description
  • group-name
  • group-id
  • owner-id
  • tag:<key>
  • tag-key
  • vpc-id
  • ...

i.e.

aws ec2 describe-security-groups --filters Name=group-name,Values="admin_ip"

Output

--output

  • json (DEFAULT)
  • text      # 用在獲得同樣rule(i.e. ssh)時的 IP list
  • table
  • yaml

--query

--query "SecurityGroups[*].{Name:GroupName,ID:GroupId}"