Security group association to EC2 instances

0

I like to remove unused security groups. Also need to know which security groups are associated with my EC2 without Going one by one on EC2 instances. Any command or solution to make it manageable ?

3개 답변
0
수락된 답변

There is actually a simple way to see the associations.

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-find-security-group-resources/

  1. Run the following command in the AWS CLI to find network interfaces associated with a security group based on the security group ID:

aws ec2 describe-network-interfaces --filters Name=group-id,Values=<group-id> --region <region> --output json

The output of this command shows the network interfaces associated with the security group.

  1. Review the output.

If the output is empty similar to this example, then there are no resources associated with the security group:

{ "NetworkInterfaces": [] }

If the output contains results, then use this command to find more information about the resources associated with the security group:

aws ec2 describe-network-interfaces --filters Name=group-id,Values=<group-id> --region <region> --output json --

You can also see from the console : Copy the security group ID of the security group that you're investigating.

In the navigation pane, choose Network Interfaces. Paste the security group ID in the search bar.

AWS
mojtoth
답변함 일 년 전
0

You can use AWS Firewall Manager to manage your security groups at scale, see this blog post.

AWS
Vincent
답변함 일 년 전
0

Hi Sarah,

You could look into AWS Config rule: https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-aws-delete-ec2-security-group.html

That rule will delete all unused Sec groups. Hope it helps!

profile picture
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠