Steven Yong
Steven Yong

Reputation: 5446

Getting AWS Security group rule ID

Does anyone know how to get this Security group rule ID via AWS SDK?

enter image description here

I use this

aws ec2 describe-security-groups --group-ids sg-0ad9f9694512344

but does not seem to return anything that starts with sgr-

Upvotes: 1

Views: 1974

Answers (2)

knockergrowl
knockergrowl

Reputation: 11

The accepted answer didn't work for me with aws-cli/2.23.15.

This is an alternative:

aws ec2 describe-security-group-rules --filters "Name=group-id,Values=sg-0ad9f9694512344"

Upvotes: 0

John Rotenstein
John Rotenstein

Reputation: 270059

Security Group Rule IDs were introduced only recently (July 2021).

See: Easily Manage Security Group Rules with the New Security Group Rule ID | AWS News Blog

Therefore, your SDK might need updating.

I checked the AWS SDK for Python (boto3) and it already has describe_security_group_rules() available.

The AWS CLI also has: describe-security-group-rules

Upvotes: 2

Related Questions