如何确定给定的AWS安全组与什么相关联? [英] How do I determine what a given AWS Security Group is associated with?

查看:64
本文介绍了如何确定给定的AWS安全组与什么相关联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AWS EC2安全组文档提到"EC2-VPC的安全组具有EC2-Classic的安全组不支持的其他功能",但是安全组"仪表板未提供有关安全组属性的功能"的任何信息这样我就可以区分正在查看的安全组类型或附加的安全组,例如,我无法确定是否可以合并安全组并在EC2实例之间共享它们(以便于管理):

The AWS EC2 Security Groups documentation mentions that "Security groups for EC2-VPC have additional capabilities that aren't supported by security groups for EC2-Classic" but the Security Groups dashboard does not provide any information on the "capabilities" of attributes of Security Groups that allow me to distinguish what kind of Security Group I'm looking at or what it is attached to, so that, for example I can't figure out whether I can consolidate Security Groups and share them across EC2 instances (for easier management):

  1. 如何确定给定的安全组是否适合给定的实例?
  2. 如何确定安全组是否与哪些实例相关联(我在实例"控制台中看到了如何反向操作)?

推荐答案

要查找与安全组 My-SG 相关的所有实例,请使用以下AWS CLI命令:

To find all instances associated with security group My-SG, use the following AWS CLI command:

aws ec2 describe-instances --filters "Name=instance.group-name,Values=My-SG" --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`].Value]' --output text

这篇关于如何确定给定的AWS安全组与什么相关联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆