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


Python VPCConnection.modify_vpc_attribute方法代码示例

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


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

示例1: _configure_environment

# 需要导入模块: from boto.vpc import VPCConnection [as 别名]
# 或者: from boto.vpc.VPCConnection import modify_vpc_attribute [as 别名]
    def _configure_environment(self):
        """Create a new disco style environment VPC"""
        vpc_cidr = self.get_config("vpc_cidr")

        # Create VPC
        vpc_conn = VPCConnection()
        self.vpc = vpc_conn.create_vpc(self.get_config("vpc_cidr"))
        keep_trying(300, self.vpc.add_tag, "Name", self.environment_name)
        keep_trying(300, self.vpc.add_tag, "type", self.environment_type)
        logging.debug("vpc: %s", self.vpc)

        dhcp_options = self._configure_dhcp()
        self.vpc.connection.associate_dhcp_options(dhcp_options.id, self.vpc.id)

        # Enable DNS
        vpc_conn.modify_vpc_attribute(self.vpc.id, enable_dns_support=True)
        vpc_conn.modify_vpc_attribute(self.vpc.id, enable_dns_hostnames=True)

        # Create metanetworks (subnets, route_tables and security groups)
        for network in self.networks.itervalues():
            network.create()

        # Configure security group rules
        for network in self.networks.values():
            self._add_sg_rules(network)

        # Set up security group rules
        self._open_customer_ports()

        # Allow ICMP (ping, traceroute & etc) and DNS traffic for all subnets
        for network in self.networks.itervalues():
            self.vpc.connection.authorize_security_group(
                group_id=network.security_group.id,
                ip_protocol="icmp",
                from_port=-1,
                to_port=-1,
                cidr_ip=vpc_cidr
            )
            self.vpc.connection.authorize_security_group(
                group_id=network.security_group.id,
                ip_protocol="udp",
                from_port=53,
                to_port=53,
                cidr_ip=vpc_cidr
            )

        # Setup internet gateway
        internet_gateway = self.vpc.connection.create_internet_gateway()
        self.vpc.connection.attach_internet_gateway(internet_gateway.id, self.vpc.id)
        logging.debug("internet_gateway: %s", internet_gateway)
        self._add_igw_routes(internet_gateway)

        self._attach_vgw()
        self.configure_notifications()
        DiscoVPC.create_peering_connections(DiscoVPC.parse_peerings_config(self.vpc.id))
        self.rds.update_all_clusters_in_vpc()
开发者ID:Angakkuit,项目名称:asiaq-aws,代码行数:58,代码来源:disco_vpc.py


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