How do I get the ARN for a security group in AWS

Viewed 4874

I'd like to be able to query the ARN of a security group, but queries like aws ec2 describe-security-groups only provide group IDs. Clearly security groups do have ARNs because API calls like aws datasync create-agent has options that require security group ARNs.

1 Answers

The ARN of security groups has known format:

arn:aws:ec2:<region>:<account>:security-group/<sg-group-id>

For example:

arn:aws:ec2:us-east-1:123445667:security-group/sg-11223344551122334

Thus you can always construct it yourself if its not explicitly given by AWS CLI.

Related