The moment it happens
Zip an S3 folder on request
One ZIP of everything under a folder, uploaded back to S3 with a download link in your inbox.
- Runs
- The moment it happens
- Apps
- AWS
- AI
- Not needed
- Access
- s3:ListBucket, s3:GetObject, s3:PutObject
Send this to your assistant
Create a ClickRuntime automation: when I call this link with a folder name, zip every file in that folder of my S3 bucket, upload the ZIP and email me a download link.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
At the end of a project, an agency needs to hand a client every deliverable: final designs, exports, reports and raw files, all stored in an S3 folder. S3 has no button to download a folder as one archive. The usual workarounds are installing the AWS CLI, syncing to a laptop, zipping by hand and uploading again somewhere else, which can take a couple of hours for a few gigabytes and fails halfway when the connection drops.
Send a request to your ClickRuntime link with the folder path. ClickRuntime lists the objects under that prefix, downloads them, packs them into one ZIP file and stores the ZIP in your bucket. You then receive an email with a presigned link to download the archive.
It suits anyone who must pass bundles of files to people outside their company without giving them bucket access. Agencies and consultants hand over projects this way.
What you get out of it
Client handovers take minutes
A request that returns a single link replaces an afternoon of syncing, zipping and re-uploading. Projects close on time and invoices go out sooner. Projects close on schedule and the final invoice goes out the same day.
Clients never get bucket access
A presigned link grants access to one archive only. You avoid creating AWS users or opening permissions just so a client can fetch their files. You avoid creating temporary AWS users for each client.
No CLI or local copy is needed
Colleagues who are not comfortable with command-line tools can still package a folder. The files never pass through a laptop, which also avoids filling a local disk. Colleagues who dislike command lines can still deliver a full folder.
Archives are stored for later
Because the ZIP is saved back to S3, you can generate a new link next month without repeating the work. There is a record of exactly what was delivered. That gives you a record of exactly what was delivered to the client.
Large folders do not break halfway
The work runs on ClickRuntime's side rather than over your home internet. A dropped hotel Wi-Fi connection no longer ruins a long download. The job finishes even if your own connection drops.
How it works
What happens, step by step
When you call your ClickRuntime link with a folder name, or on the monthly schedule if you set one, the automation starts.
It downloads every file under that folder in your S3 bucket and packs them into one ZIP.
It uploads the ZIP back to S3.
You get an email with the number of files and a temporary download link.
Before it runs live
- Connect AWS
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other AWS steps into one automation
Under the hood
The code that runs this automation
import io
import zipfile
import boto3
from clickruntime import on_event, credentials, notify
REGION = "us-east-1"
def aws(service):
return boto3.client(service, region_name=REGION, aws_access_key_id=credentials.secret("AWS_ACCESS_KEY_ID"),
aws_secret_access_key=credentials.secret("AWS_SECRET_ACCESS_KEY"))
BUCKET = "acme-files"
@on_event
def handle(event):
folder = (event.json or {})["folder"].strip("/") + "/"
s3 = aws("s3")
buf, count = io.BytesIO(), 0
with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as zf:
for page in s3.get_paginator("list_objects_v2").paginate(Bucket=BUCKET, Prefix=folder):
for o in page.get("Contents", []):
zf.writestr(o["Key"][len(folder):], s3.get_object(Bucket=BUCKET, Key=o["Key"])["Body"].read())
count += 1
key = f"zips/{folder.strip('/').replace('/', '-')}.zip"
s3.put_object(Bucket=BUCKET, Key=key, Body=buf.getvalue())
link = s3.generate_presigned_url("get_object", Params={"Bucket": BUCKET, "Key": key}, ExpiresIn=7 * 24 * 3600)
notify.email_me(f"ZIP of {folder} ready ({count} files)", link)
return {"files": count, "key": key}FAQ
Common questions
Is there a limit on how much can be zipped?
Will the folder structure be preserved?
How long is the download link valid?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Store files sent to a link in S3
Files or file URLs posted to your link are saved in your bucket under the date, and you get a download link.
See how it worksRead totals from receipts dropped in S3
New receipts and PDFs in your bucket have their vendor, date and total pulled out and emailed to you.
See how it worksSee yesterday's AWS bill by service
Each morning you get yesterday's spend broken down by service, with costly ones flagged.
See how it worksKeep exploring
Set up “Zip an S3 folder on request” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.