示例关系查询 - Amazon 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'

OR

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'

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

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'