runway.s3_utils module
Utility functions for S3.
- runway.s3_utils.purge_and_delete_bucket(bucket_name: str, region: str = 'us-east-1', session: Optional[boto3.session.Session] = None) None [source]
Delete all objects and versions in bucket, then delete bucket.
- runway.s3_utils.purge_bucket(bucket_name: str, region: str = 'us-east-1', session: Optional[boto3.session.Session] = None) None [source]
Delete all objects and versions in bucket.
- runway.s3_utils.delete_bucket(bucket_name: str, region: str = 'us-east-1', session: Optional[boto3.session.Session] = None) None [source]
Delete bucket.
- runway.s3_utils.does_bucket_exist(bucket_name: str, region: str = 'us-east-1', session: Optional[boto3.session.Session] = None) bool [source]
Check if bucket exists in S3.
- runway.s3_utils.ensure_bucket_exists(bucket_name: str, region: str = 'us-east-1', session: Optional[boto3.session.Session] = None) None [source]
Ensure S3 bucket exists.
- runway.s3_utils.does_s3_object_exist(bucket: str, key: str, session: Optional[boto3.session.Session] = None, region: str = 'us-east-1') bool [source]
Determine if object exists on s3.
- runway.s3_utils.upload(bucket: str, key: str, filename: str, session: Optional[boto3.session.Session] = None) None [source]
Upload file to S3 bucket.
- runway.s3_utils.download(bucket: str, key: str, file_path: str, session: Optional[boto3.session.Session] = None) str [source]
Download a file from S3 to the given path.
- runway.s3_utils.download_and_extract_to_mkdtemp(bucket: str, key: str, session: Optional[boto3.session.Session] = None) str [source]
Download zip archive and extract it to temporary directory.
- runway.s3_utils.get_matching_s3_objects(bucket: str, prefix: Sequence[str] = '', suffix: str = '', session: Optional[boto3.Session] = None) Iterator[ObjectTypeDef] [source]
Generate objects in an S3 bucket.
- Parameters
bucket – Name of the S3 bucket.
prefix – Only fetch objects whose key starts with this prefix (optional).
suffix – Only fetch objects whose keys end with this suffix (optional).
session – Boto3/botocore session.
- runway.s3_utils.get_matching_s3_keys(bucket: str, prefix: str = '', suffix: str = '', session: Optional[boto3.session.Session] = None) Iterator[str] [source]
Generate the keys in an S3 bucket.
- Parameters
bucket – Name of the S3 bucket.
prefix – Only fetch keys that start with this prefix (optional).
suffix – Only fetch keys that end with this suffix (optional).
session – Boto3/botocore session.