关系查询示例 - AWS Config
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

关系查询示例

找到与EC2实例相关的EIP

SELECT resourceId WHERE resourceType = 'AWS::EC2::EIP' AND relationships.resourceId = 'i-abcd1234'

查找与EC2网络接口相关的EIP

SELECT resourceId WHERE resourceType = 'AWS::EC2::EIP' AND relationships.resourceId = 'eni-abcd1234'

找到与安全组相关的EC2实例和网络接口

SELECT resourceId WHERE resourceType IN ('AWS::EC2::Instance', 'AWS::EC2::NetworkInterface') AND relationships.resourceId = 'sg-abcd1234'

或者

SELECT resourceId WHERE resourceType = 'AWS::EC2::Instance' AND relationships.resourceId = 'sg-abcd1234' SELECT resourceId WHERE resourceType = 'AWS::EC2::NetworkInterface' AND relationships.resourceId = 'sg-abcd1234'

找到与子网相关的ec2实例、网络ACL、网络接口和路由表

SELECT resourceId WHERE resourceType IN ('AWS::EC2::Instance', 'AWS::EC2::NetworkACL', 'AWS::EC2::NetworkInterface', 'AWS::EC2::RouteTable') AND relationships.resourceId = 'subnet-abcd1234'

查找与VPC相关的EC2实例、Internet网关、网络ACL、网络接口、路由表、子网和安全组

SELECT resourceId WHERE resourceType IN ('AWS::EC2::Instance', 'AWS::EC2::InternetGateway', 'AWS::EC2::NetworkACL', 'AWS::EC2::NetworkInterface', 'AWS::EC2::RouteTable', 'AWS::EC2::Subnet', 'AWS::EC2::SecurityGroup') AND relationships.resourceId = 'vpc-abcd1234'

找到与VPN网关相关的EC2路由表

SELECT resourceId WHERE resourceType = 'AWS::EC2::RouteTable' AND relationships.resourceId = 'vgw-abcd1234'