aws
AWS Cloud Utility API
This module provides utility functions to interact with AWS services.
Functions:
-
download_s3_file
–Download a file from S3
-
download_s3_object
–Download an object from S3
-
download_s3_objects
–Download all objects in a S3 bucket with a given prefix
Functions
download_s3_file
download_s3_file(key: str, dst: Path, bucket: str, client: boto3.client = None, checksum: str = 'size', config: Config | None = Config(signature_version=UNSIGNED)) -> bool
Download a file from S3
Parameters:
-
key
(str
) –Object key
-
dst
(Path
) –Destination path
-
bucket
(str
) –Bucket name
-
client
(client
, default:None
) –S3 client
-
checksum
(str
, default:'size'
) –Checksum type. Defaults to "size".
-
config
(Config
, default:Config(signature_version=UNSIGNED)
) –Boto3 config. Defaults to Config(signature_version=UNSIGNED).
Returns:
-
bool
(bool
) –True if file was downloaded, False if already exists
Source code in neuralspot_edge/utils/aws.py
download_s3_object
download_s3_object(item: dict[str, str], dst: Path, bucket: str, client: boto3.client = None, checksum: str = 'size', config: Config | None = Config(signature_version=UNSIGNED)) -> bool
Download an object from S3
Parameters:
-
item
(dict[str, str]
) –Object metadata
-
dst
(Path
) –Destination path
-
bucket
(str
) –Bucket name
-
client
(client
, default:None
) –S3 client
-
checksum
(str
, default:'size'
) –Checksum type. Defaults to "size".
-
config
(Config
, default:Config(signature_version=UNSIGNED)
) –Boto3 config. Defaults to Config(signature_version=UNSIGNED).
Returns:
-
bool
(bool
) –True if file was downloaded, False if already exists
Source code in neuralspot_edge/utils/aws.py
download_s3_objects
download_s3_objects(bucket: str, prefix: str, dst: Path, checksum: str = 'size', progress: bool = True, num_workers: int | None = None, config: Config | None = Config(signature_version=UNSIGNED))
Download all objects in a S3 bucket with a given prefix
Parameters:
-
bucket
(str
) –Bucket name
-
prefix
(str
) –Prefix to filter objects
-
dst
(Path
) –Destination directory
-
checksum
(str
, default:'size'
) –Checksum type. Defaults to "size".
-
progress
(bool
, default:True
) –Show progress bar. Defaults to True.
-
num_workers
(int | None
, default:None
) –Number of workers. Defaults to None.
-
config
(Config | None
, default:Config(signature_version=UNSIGNED)
) –Boto3 config. Defaults to Config(signature_version=UNSIGNED).