def __init__(self, config, logger):
        AWSConfig.__init__(self, config.config, logger)

        self.conn = boto.ec2.connect_to_region(
            self.region,
            aws_access_key_id=self.access_key,
            aws_secret_access_key=self.secret_key
        )
    def setup_aws_frontend(self):
        self.cfg = self.config.cfg

        i = aws_create_keypair.CreateKeyPair(
            config=self.config,
            user_path=self.config.user_path,
            logger=self.logger
        )
        i.create()

        self.config.save('EC2', 'key_pair', "%s/%s.pem" % (self.config.user_path, self.config.cfg.get('EC2', 'key_name')))

        self.key_pair = self.cfg.get('EC2', 'key_pair')

        config = AWSConfig(self.config, self.logger)
        showcase_url = None
        if not config.is_autoscalable:
            i = aws_create_instance.CreateEC2Instance(config=config, logger=self.logger)

            instances = i.create_all(config.num_instances)


            for instance in instances:
                self.ip_addresses.append(instance.ip_address)

            config.ip_addresses = self.ip_addresses
            loadbalancer = None
            if len(instances) > 1:
                i = aws_create_loadbalancer.CreateLoadbalancer(
                    config=config,
                    logger=self.logger
                )
                loadbalancer = i.create(instances)

            deploy_showcase.DeploySoftware(config)

            showcase_url = loadbalancer.dns_name if loadbalancer else instances[0].ip_address

        else:
            i = aws_create_instance.CreateEC2Instance(config=config, logger=self.logger)
            instance = i.create()
            self.config.save('infrastructure', 'ip_address', instance.ip_address)
            self.ip_addresses.append(instance.ip_address)

            config.ip_addresses = self.ip_addresses
            deploy_showcase.DeploySoftware(config)

            aws_create_ami.EC2CreateAMI(config=config, logger=self.logger)

            autoscalability = aws_create_autoscalability.Autoscalability(
                config=config,
                logger=self.logger
            )
            showcase_url = autoscalability.create()

        time.sleep(60)
        return showcase_url
    def __init__(self, config, logger):
        AWSConfig.__init__(self, config, logger)

        self.conn = boto.ec2.connect_to_region(self.region,
                                               aws_access_key_id=self.access_key,
                                               aws_secret_access_key=self.secret_key)

        ami_id = self.create_ami(self.cfg.get('infrastructure', 'ip_address'))
        self.config.config.save('infrastructure', 'ami_id', ami_id)
        self.logger.log("Done")
示例#4
0
    def __init__(self, config, logger):
        AWSConfig.__init__(self, config, logger)

        self.instance_ids = []
        self.ip_addresses = []

        self.file_path = "/".join(os.path.abspath(__file__).split('/')[:-1])

        self.remote_deploy_path = self.cfg.get('software', 'remote_deploy_path')
        self.deploy_name = "showcase-1-a"
示例#5
0
    def __init__(self, config, logger):
        AWSConfig.__init__(self, config, logger)

        self.conn = boto.rds.connect_to_region(self.region,
                                               aws_access_key_id=self.access_key,
                                               aws_secret_access_key=self.secret_key
        )

        sg_id = self.create_security_group('mysql', 'Security group for MYSQL protocol', '3306', '0.0.0.0/0')
        instance = self.create_master(sg_id)
        self.import_data(instance)

        replicas_urls = []
        if self.rds_num_replicas > 0:
            replicas_urls = self.create_read_replicas()

        self.write_config(instance.endpoint[0], replicas_urls)
 def __init__(self, user_path, config, logger):
     AWSConfig.__init__(self, config, logger)
     self.user_path = user_path
 def __init__(self, config, logger):
     AWSConfig.__init__(self, config, logger)
 def __init__(self, config, logger):
     AWSConfig.__init__(self, config, logger)
     self.as_ami_id = self.cfg.get('infrastructure', 'ami_id')