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:
-
(keystr) –Object key
-
(dstPath) –Destination path
-
(bucketstr) –Bucket name
-
(clientclient, default:None) –S3 client
-
(checksumstr, default:'size') –Checksum type. Defaults to "size".
-
(configConfig, 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:
-
(itemdict[str, str]) –Object metadata
-
(dstPath) –Destination path
-
(bucketstr) –Bucket name
-
(clientclient, default:None) –S3 client
-
(checksumstr, default:'size') –Checksum type. Defaults to "size".
-
(configConfig, 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:
-
(bucketstr) –Bucket name
-
(prefixstr) –Prefix to filter objects
-
(dstPath) –Destination directory
-
(checksumstr, default:'size') –Checksum type. Defaults to "size".
-
(progressbool, default:True) –Show progress bar. Defaults to True.
-
(num_workersint | None, default:None) –Number of workers. Defaults to None.
-
(configConfig | None, default:Config(signature_version=UNSIGNED)) –Boto3 config. Defaults to Config(signature_version=UNSIGNED).