Skip to content

Instantly share code, notes, and snippets.

@anteverse
Last active October 30, 2021 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anteverse/d5c5c1635b3fab188b4dc3fd84ef1a98 to your computer and use it in GitHub Desktop.
Save anteverse/d5c5c1635b3fab188b4dc3fd84ef1a98 to your computer and use it in GitHub Desktop.
Remove the disk usage
zip_obj = s3_resource.Object("path/to/key.zip")
buffer = BytesIO(zip_obj.get()["Body"].read())
with ZipFile(buffer) as zipfile:
for file_name in zipfile.namelist():
s3_client.upload_fileobj(
fileobj=zipfile.open(file_name),
Bucket="my_bucket",
Key=f"some_prefix/{file_name}",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment