Ejemplo n.º 1
0
def _create_s3_connection():
    platform = __node__['platform']
    region = platform.get_region()
    endpoint = platform._s3_endpoint(region)
    try:
        key_id, key = platform.get_access_keys()
        conn = boto.connect_s3(host=endpoint,
                               aws_access_key_id=key_id,
                               aws_secret_access_key=key)
    except (AttributeError, PlatformError, boto.exception.NoAuthHandlerFound):
        raise NoCredentialsError(sys.exc_info()[1])
    return conn
Ejemplo n.º 2
0
def _create_ec2_connection():
    platform = __node__['platform']
    region = platform.get_region()
    try:
        key_id, key = platform.get_access_keys()
        conn = boto.ec2.connect_to_region(region,
                                          aws_access_key_id=key_id,
                                          aws_secret_access_key=key)
        if not conn:
            raise ConnectionError('Invalid region: %s' % region)
    except (PlatformError, boto.exception.NoAuthHandlerFound):
        raise NoCredentialsError(sys.exc_info()[1])
    return conn
Ejemplo n.º 3
0
def _create_s3_connection():
    platform = __node__['platform']
    region = platform.get_region()
    endpoint = platform._s3_endpoint(region)
    try:
        key_id, key = platform.get_access_keys()
        conn = boto.connect_s3(
            host=endpoint,
            aws_access_key_id=key_id,
            aws_secret_access_key=key
        )
    except (AttributeError, PlatformError, boto.exception.NoAuthHandlerFound):
        raise NoCredentialsError(sys.exc_info()[1])
    return conn
Ejemplo n.º 4
0
def _create_ec2_connection():
    platform = __node__['platform']
    region = platform.get_region()
    try:
        key_id, key = platform.get_access_keys()
        conn = boto.ec2.connect_to_region(
            region,
            aws_access_key_id=key_id,
            aws_secret_access_key=key
        )
        if not conn:
            raise ConnectionError('Invalid region: %s' % region)
    except (PlatformError, boto.exception.NoAuthHandlerFound):
        raise NoCredentialsError(sys.exc_info()[1])
    return conn