Nodes/ComfyUI_S3_direct/Direct Save Image To S3
ComfyUI Node

Direct Save Image To S3

Save Image, except the file never touches your local disk

By KunmyonChoi·Created 2 years ago·Updated 2 years ago· 0
Direct Save Image To S3
  • images
  • files
s3_buckets3_bucket
pathnamepathname for file
region
aws_ak
aws_sk

When your ComfyUI runs on a rented GPU box or a server that isn't where you actually want your files, the stock "Save Image" node starts to feel wrong. Every PNG lands in output/, and then you're left scp-ing it somewhere before the instance gets recycled. Direct Save Image To S3 is the cloud twin of Save Image: an IMAGE tensor goes in, a PNG comes out - written straight into an S3 bucket, never touching local disk.

It comes from KunmyonChoi's ComfyUI_S3_direct, a one-file pack the author describes as a "simplified version" of the older kealiu/ComfyUI-S3-Tools. There's no UI gallery, no fancy preview wiring - just a node that takes your image and put_objects it to the bucket. For a batch of generated images you want archived to a shared bucket, that's honestly the whole job, and it does it in a couple of lines.

How it works

The node converts your IMAGE tensor to a PNG in memory (BytesIO, PIL, no temp file), then calls client.put_object(Body=buff, Key=key, Bucket=bucket). Two behaviors are baked into the code and worth knowing before they surprise you:

  • Whatever extension you type in pathname, it's stripped (.jpg, .png, .webp all get removed) and the file is always saved as .png.
  • If your batch has more than one image, the node appends a counter - out.png, out_0.png, out_1.png, ... - instead of overwriting.

Inputs and outputs

Only three inputs actually matter:

  • images - the IMAGE tensor, same as Save Image.
  • s3_bucket - your bucket name. The default "s3_bucket" is a placeholder; leave it and nothing uploads.
  • pathname - the object key inside the bucket (e.g. jobs/job-42/hero). Default is the literal string "pathname for file" - replace it.

Optional region, aws_ak, aws_sk exist for credentials; see below. The single output is files (FILES), a metadata record with filename, bucket, and pathname - mostly useful for passing around or logging; the node is marked as an output node, so it ends the branch.

Install

This is the whole pack, so install it once and you get all three nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/KunmyonChoi/ComfyUI_S3_direct

Then restart ComfyUI. ComfyUI Manager can do it too - search the pack title "ComfyUI_S3_direct" and hit install. requirements.txt lists only torch (already present in every ComfyUI) and boto3, so boto3 is the one real dependency. No model files, no weights, nothing to download.

Credentials and gotchas

Credentials resolve in this order: environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) override the node's fields; if the node fields are filled, they're used; if everything's empty, boto3 falls back to its normal chain (~/.aws/credentials, IAM role, ...). One trap from the source: filling aws_ak without aws_sk silently drops back to the default chain instead of erroring.

Where people get burned with this pack: forgetting the bucket placeholder, and expecting a local copy to exist (there isn't one - if you also want the file on disk, keep a plain Save Image in parallel). And a real limitation: there's no endpoint_url parameter, so S3-compatible services that need a custom endpoint - MinIO, Cloudflare R2, Wasabi - can't be reached with this pack as written. Plain AWS S3, fine. Everything else, shop elsewhere.

CategoryDirectS3

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
s3_bucketSTRINGs3_bucket
pathnameSTRINGpathname for file
regionoptSTRING
aws_akoptSTRING
aws_skoptSTRING

Outputs (1)

NameTypeDescription
filesFILES