← All posts

How to Zip a Folder in Amazon S3 (Console, CLI and API)

Updated 2026-10-21

Amazon S3 has no zip command. Neither the AWS console nor the CLI can turn a folder of objects into a single archive by itself. So how do people actually do it? There are four practical routes, and they differ a lot in effort and cost.

1. Console: download, zip, upload

Select the folder in the console, download the objects, zip them on your computer, and upload the archive back. Fine for a handful of small files. Painful for anything large: you download every file and pay egress for it, and the process is manual.

2. AWS CLI: copy locally, then zip

aws s3 cp s3://my-bucket/reports/ ./reports/ --recursive
cd reports && zip -r ../reports.zip .
aws s3 cp ../reports.zip s3://my-bucket/reports.zip

Scriptable, but it needs local disk for the whole folder and downloads every byte. For a 50 GB folder, you pay for 100 GB of transfer and need 50 GB of disk.

3. EC2 or Lambda: stream the folder through a zip writer

Run code that reads each object and writes it into a zip stream, uploading the archive back to S3. This avoids local storage, but you build and operate the code. Lambda works for small and medium sets but has a 15-minute limit and limited temporary storage; large folders need EC2 or a queue-based worker.

4. An API that does it for you

S3zipper takes a folder prefix, expands it, compresses the files inside AWS, and writes the archive back to your bucket. One HTTP request, no server to run:

curl -X POST https://api.s3zipper.com/v1/zipstart \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "awsKey": "AKIA...",
    "awsSecret": "...",
    "awsBucket": "my-bucket",
    "awsRegion": "us-east-1",
    "filePaths": ["my-bucket/reports/2026"],
    "zipFileName": "reports-2026.zip"
  }'

You get a task id back immediately, poll /v1/zipstate, and fetch the signed download URL from /v1/zipresult.

Which route should you use?

  • A few tiny files, one time — the console is fine.
  • Regular automation — an API keeps your code short and avoids moving data twice.
  • Very custom packaging logic — a small Lambda or EC2 worker makes sense if you need to transform files first.

Read the full request/response walkthrough in How to start a zip job, or see what works and what doesn't when zipping a whole bucket.

Try it on your own bucket

Create a free account and zip S3 files on the fly — no downloads, no local disk.

Create free account API docs

← All posts