View a markdown version of this page

Copying a file from an Amazon S3 bucket using an S3 access point - FSx for OpenZFS

Copying a file from an Amazon S3 bucket using an S3 access point

The following copy-object example command shows how you can use the AWS CLI to copy an object from an Amazon S3 bucket to an FSx for OpenZFS volume through an access point.

The example copies the object my-image.jpg from the bucket amzn-s3-demo-bucket through the access point my-openzfs-ap and saves the file as my-image.jpg.

$ aws s3api copy-object --copy-source amzn-s3-demo-bucket/my-image.jpg --bucket my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias --key my-image.jpg

You can also use the AWS CLI s3 cp command. For large files, s3 cp copies the file in parts with UploadPartCopy, so it can copy files larger than 5 GB. For more information, see cp in the AWS CLI Command Reference.

$ aws s3 cp s3://amzn-s3-demo-bucket/my-image.jpg s3://my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias/my-image.jpg

To move the file instead of copying it, use the AWS CLI s3 mv command, which copies the file to the FSx for OpenZFS volume and then deletes it from the bucket. For more information, see mv in the AWS CLI Command Reference.

$ aws s3 mv s3://amzn-s3-demo-bucket/my-image.jpg s3://my-openzfs-ap-hrzrlukc5m36ft7okagglf3gmwluquse1b-ext-s3alias/my-image.jpg

You can also use the REST API to copy an object through an access point. For more information, see CopyObject in the Amazon Simple Storage Service API Reference.