本文整理汇总了Python中boto.vpc.VPCConnection.associate_route_table方法的典型用法代码示例。如果您正苦于以下问题:Python VPCConnection.associate_route_table方法的具体用法?Python VPCConnection.associate_route_table怎么用?Python VPCConnection.associate_route_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.vpc.VPCConnection
的用法示例。
在下文中一共展示了VPCConnection.associate_route_table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import associate_route_table [as 别名]
print "created security groups"
reservation = connection.run_instances(image_id=nat_linux_image, instance_type='t2.micro', key_name='kaihon', subnet_id=public_subnet.id, security_group_ids=[host_security_group.id])
instance = reservation.instances[0]
connection.modify_instance_attribute(instance.id, attribute='sourceDestCheck', value=False)
print "modified instance to ignore source and destination checks"
## the following does not work
while instance.state == 'pending':
time.sleep(5)
instance.update()
instance.add_tag('Name', 'Nat-Instance')
public_route_table = connection.create_route_table(private_cloud.id)
print "created public route table"
private_route_table = connection.create_route_table(private_cloud.id)
print "created private route table"
connection.create_route(public_route_table.id, '0.0.0.0/0', igw.id, None, None, None, False)
connection.create_route(private_route_table.id, '0.0.0.0/0', None, instance.id, None, None, False)
connection.associate_route_table(private_route_table.id, private_subnet.id)
connection.associate_route_table(public_route_table.id, public_subnet.id)
elastic_ip = connection.allocate_address(domain=None, dry_run=False)
elastic_ip.associate(instance_id=instance.id, network_interface_id=None, private_ip_address=None, allow_reassociation=False, dry_run=False)