Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 346
mmcynr543 Avatar asked Oct 22 '20 22:10

mmcynr543


People also ask

Does AWS security Group have Arn?

Clearly security groups do have ARNs because API calls like aws datasync create-agent has options that require security group ARNs.

How do I find my Arn number AWS?

To get an ARN from the AWS Management Console, navigate to the resource you want an ARN for, and view the details for that resource. For example, you can get the ARN for a DB instance from the Configuration tab of the DB instance details, as shown following.

How do I find my AWS security Group ID?

To view your security groups using the consoleOpen the Amazon VPC console at https://console.aws.amazon.com/vpc/ . In the navigation pane, choose Security Groups. Your security groups are listed. To view the details for a specific security group, including its inbound and outbound rules, select the security group.


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.

like image 191
Marcin Avatar answered Oct 27 '22 16:10

Marcin