Ignitify.dev

s3-storage

Upload a file to an S3-compatible bucket and return a download link.

StorageSettings + codeStarter plan or higher

What you no longer build

  • The upload code and the signed download link.
  • A way to return a result that is bigger than 10 KiB: the task returns a short link.
  • The secret names and the network settings for the bucket.

Add it to a task

Read the plan first. --dry-run shows every setting and changes nothing. Then run it again and answer y.

terminal
$ ignitify integration:add s3-storage --task <slug> --dry-run
terminal
$ ignitify integration:add s3-storage --task <slug>

What it writes into task.yaml

  • secrets: S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY
  • execution.network.type: egress (if the task has no network)

What you add yourself

  • The values of the two secrets, with secret:set.
  • Your bucket host in execution.network.egress_allow. On AWS it is <bucket>.s3.<region>.amazonaws.com.

Use it in your code

index.ts
import { storage } from '@ignitify-integrations/s3-storage';

export async function run(payload, ctx) {
  const file = await buildReport(payload); // a path on the scratch disk
  const store = storage(ctx, { bucket: 'acme-reports', region: 'eu-west-1' });
  const url = await store.putAndLink(file, { expiresSec: 86400, contentType: 'application/pdf' });
  return { url };
}

Limits

  • Works with AWS S3, Cloudflare R2, Backblaze B2 and MinIO.
  • One upload is at most 5 GiB. A link is valid for 1 second to 7 days.
  • Errors and logs never contain your keys.

All options are in the README. To check, upgrade or remove an integration, see the Integrations guide.

Other integrations