s3Copy

Copies an object from one S3 (or S3-compatible) bucket to another (or to a different key in the same bucket).

s3Copy(srcBucket, srcObject, trgBucket [, trgObject, acl, accessKeyId, secretKey, host]) → returns void

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

srcBucket string
Required

The source bucket name.

srcObject string
Required

The source object key.

trgBucket string
Required

The destination bucket name.

trgObject string

The destination object key. Defaults to the source object key.

acl string

Object ACL to apply to the copy (accepted for compatibility; not enforced).

accessKeyId string

Inline AWS access key id. Overrides credentials from Application.cfc and environment variables.

secretKey string

Inline AWS secret access key.

host string

Inline endpoint URL for S3-compatible providers (e.g. Cloudflare R2, MinIO).

Examples
Sample code invoking the s3Copy function

Copies the object, keeping the same key in the target bucket.

s3Copy("src-bucket", "reports/q3.pdf", "trg-bucket");

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub