aws_utils package
Submodules
aws_utils.glacier_utils module
- aws_utils.glacier_utils.authorize(aws_access_key_id, aws_secret_access_key, aws_session_token)
authorize checks AWS credentials - if authenticated returns True, else initiates login sequence
- Parameters
aws_access_key_id (str) – the AWS access key part of your credentials
aws_secret_access_key (str) – the AWS secret access key part of your credentials
aws_session_token (str) – the session token part of your credentials
- Returns
True if authenticated
- Return type
Optional[bool]
- aws_utils.glacier_utils.restore_object(key, days, bucket='digpath-data')
restore_object restores an object in Amazon S3 from Glacier to Standard
- Parameters
key (str) – object key for which image/object to restore
days (int) – how many days the object should be restored for (after this time period, the object will go back into glacier)
bucket (str) – the name of the bucket containing the object to restore
- Returns
stderr if an error occurs when running the command
- Return type
Optional[IO[str]]
- aws_utils.glacier_utils.status_update(key, bucket='digpath-data')
status_update sends a HEAD request to get the status of object restoration
- Parameters
key (str) – object key for which image/object to restore
bucket (str) – the name of the bucket containing the object to restore
- Returns
stderr if an error occurs when executing command, else returns stdout
- Return type
Optional[IO[str]]
aws_utils.s3_sagemaker_utils module
- class aws_utils.s3_sagemaker_utils.S3SageMakerUtils
Bases:
objectA class to initiate a s3 sagemaker session
- download_data(path, bucket='digpath-cache', key_prefix='latest')
Download local file or directory from S3
- Parameters
path (str) – local path where the file or directory should be downloaded to
bucket (str) – name of the s3 bucket to download from
key_prefix – optional s3 object key name prefix
:type str
- upload_data(path, bucket='digpath-cache', key_prefix='latest')
Upload local file or directory to S3
- Parameters
path (str) – path (absolute or relative) of local file or directory to upload
bucket (str) – name of the s3 bucket to upload to
key_prefix (str) – optional s3 object key name prefix, s3 uses the prefix to create a directory structure for the bucket content