Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 21, 2024

Copy files

Note: You can only copy files up to 5GB in a single operation

You can copy an existing file to a different path within the storage bucket using the copy API.

The copy method duplicates an existing file to a designated path and returns an object {path: 'destPath'} upon successful completion.

import { copy } from 'aws-amplify/storage';
const copyFile = async () => {
try {
const response = await copy({
source: {
path: 'album/2024/1.jpg',
// Alternatively, path: ({identityId}) => `album/{identityId}/1.jpg`
destination: {
path: 'shared/2024/1.jpg',
// Alternatively, path: ({identityId}) => `shared/{identityId}/1.jpg`
} catch (error) {
console.error('Error', err);

Cross identity ID copying is only allowed if the destination path has the the right access rules to allow other authenticated users writing to it.

More copy options

OptionTypeDescriptionReference Links
useAccelerateEndpointbooleanWhether to use accelerate endpoint.Transfer Acceleration