当前位置: 首页>>代码示例>>Python>>正文


Python VPCConnection.attach_internet_gateway方法代码示例

本文整理汇总了Python中boto.vpc.VPCConnection.attach_internet_gateway方法的典型用法代码示例。如果您正苦于以下问题:Python VPCConnection.attach_internet_gateway方法的具体用法?Python VPCConnection.attach_internet_gateway怎么用?Python VPCConnection.attach_internet_gateway使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto.vpc.VPCConnection的用法示例。


在下文中一共展示了VPCConnection.attach_internet_gateway方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print

# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import attach_internet_gateway [as 别名]
private_cloud 		= connection.create_vpc(cloud_network)

time.sleep(2) #fix race condition later
private_cloud.add_tag('Name', 'virtual-private-cloud')
print ("created vpc", private_cloud.id)

private_subnet = connection.create_subnet(private_cloud.id, green_subnet)
time.sleep(2) #fix race condition later
private_subnet.add_tag('Name', 'green_subnet')
public_subnet = connection.create_subnet(private_cloud.id, blue_subnet)
time.sleep(2)
public_subnet.add_tag('Name', 'blue_subnet')
print "created public and private subnets"

igw = connection.create_internet_gateway()
connection.attach_internet_gateway(igw.id, private_cloud.id)

print "created and attached internet gateway"

host_security_group = connection.create_security_group('private_cloud_sg', 'private_cloud_sg', private_cloud.id)
host_security_group.authorize('tcp', 80, 80, '0.0.0.0/0')
host_security_group.authorize('tcp', 22, 22, '0.0.0.0/0')

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"
开发者ID:kaiho,项目名称:awstests,代码行数:33,代码来源:create-environment.py

示例2: attach_internet_gateway

# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import attach_internet_gateway [as 别名]
def attach_internet_gateway(igw, vpc):
    ec2region = vpc.region
    conn = VPCConnection(region=ec2region)
    conn.attach_internet_gateway(igw.id, vpc.id)
开发者ID:syokenz,项目名称:aws-scripts,代码行数:6,代码来源:vpc.py


注:本文中的boto.vpc.VPCConnection.attach_internet_gateway方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。