对于aws路由表,至少都会有一个路由条目,即VPC段的local路由,如下
192.168.115.0/24 local Active No
这样,在获取路由表及条目时,我们可以根据Routes键获得的所有的路由表条目,多个字典组成
笔者工作环境常用到的路由表条目的键值,如下
['DestinationCidrBlock', 'GatewayId', 'Origin', 'State'] ['DestinationCidrBlock', 'InstanceId', 'InstanceOwnerId', 'NetworkInterfaceId', 'Origin', 'State'] ['DestinationCidrBlock', 'NatGatewayId', 'Origin', 'State'] ['DestinationCidrBlock', 'NetworkInterfaceId', 'Origin', 'State'] ['DestinationCidrBlock', 'Origin', 'State', 'VpcPeeringConnectionId'] ['DestinationPrefixListId', 'GatewayId', 'Origin', 'State']
为了生成路由表条目CMDB数据,获得全部的路由表条目,可以for循环Routes,将每条路由表ID及其他信息,追加到一个数据列表之中
当然也还有一些其他键值,可以通过官网得到如下完整的键值
-
Routes (list) –
The routes in the route table.
-
(dict) –
Describes a route in a route table.
-
DestinationCidrBlock (string) –
The IPv4 CIDR block used for the destination match.
-
DestinationIpv6CidrBlock (string) –
The IPv6 CIDR block used for the destination match.
-
DestinationPrefixListId (string) –
The prefix of the Amazon Web Service.
-
EgressOnlyInternetGatewayId (string) –
The ID of the egress-only internet gateway.
-
GatewayId (string) –
The ID of a gateway attached to your VPC.
-
InstanceId (string) –
The ID of a NAT instance in your VPC.
-
InstanceOwnerId (string) –
The ID of Amazon Web Services account that owns the instance.
-
NatGatewayId (string) –
The ID of a NAT gateway.
-
TransitGatewayId (string) –
The ID of a transit gateway.
-
LocalGatewayId (string) –
The ID of the local gateway.
-
CarrierGatewayId (string) –
The ID of the carrier gateway.
-
NetworkInterfaceId (string) –
The ID of the network interface.
-
Origin (string) –
Describes how the route was created.
-
CreateRouteTable
- The route was automatically created when the route table was created. -
CreateRoute
- The route was manually added to the route table. -
EnableVgwRoutePropagation
- The route was propagated by route propagation.
-
-
State (string) –
The state of the route. The
blackhole
state indicates that the route’s target isn’t available (for example, the specified gateway isn’t attached to the VPC, or the specified NAT instance has been terminated). -
VpcPeeringConnectionId (string) –
The ID of a VPC peering connection.
-
CoreNetworkArn (string) –
The Amazon Resource Name (ARN) of the core network.
-
-
尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/17998588
作者:一名卑微的IT民工
出处:https://www.cnblogs.com/5201351
本博客所有文章仅用于学习、研究和交流目的,欢迎非商业性质转载。
由于博主的水平不高,文章没有高度、深度和广度,只是凑字数,不足和错误之处在所难免,希望大家能够批评指出。
博主是利用读书、参考、引用、复制和粘贴等多种方式打造成自己的文章,请原谅博主成为一个卑微的IT民工!