Exemple #1
0
    def __init__(self,
            region='us-west-1',
            s3_bucket=None,
            image_id=None,
            aws_key_name=None,
            iam_profile=None,
            **kwargs
            ):
        # find config file
        from doodad.ec2.autoconfig import AUTOCONFIG
        from doodad.ec2.credentials import AWSCredentials
        s3_bucket = AUTOCONFIG.s3_bucket() if s3_bucket is None else s3_bucket
        image_id = AUTOCONFIG.aws_image_id(region) if image_id is None else image_id
        aws_key_name= AUTOCONFIG.aws_key_name(region) if aws_key_name is None else aws_key_name
        iam_profile= AUTOCONFIG.iam_profile_name() if iam_profile is None else iam_profile
        credentials=AWSCredentials(aws_key=AUTOCONFIG.aws_access_key(), aws_secret=AUTOCONFIG.aws_access_secret())
        security_group_ids = AUTOCONFIG.aws_security_group_ids()[region]
        security_groups = AUTOCONFIG.aws_security_groups()

        super(EC2AutoconfigDocker, self).__init__(
                s3_bucket=s3_bucket,
                image_id=image_id,
                aws_key_name=aws_key_name,
                iam_instance_profile_name=iam_profile,
                credentials=credentials,
                region=region,
                security_groups=security_groups,
                security_group_ids=security_group_ids,
                **kwargs
                )
Exemple #2
0
 def __init__(self, s3_path, s3_bucket=None, sync_interval=15, output=False,
         include_types=('*.txt', '*.csv', '*.json', '*.gz', '*.tar', '*.log', '*.pkl'), **kwargs):
     super(MountS3, self).__init__(**kwargs)
     if s3_bucket is None:
         # load from config
         from doodad.ec2.autoconfig import AUTOCONFIG
         s3_bucket = AUTOCONFIG.s3_bucket()
     self.s3_bucket = s3_bucket
     self.s3_path = s3_path
     self.output = output
     self.sync_interval = sync_interval
     self.sync_on_terminate = True
     self.include_types = include_types