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

Page updated May 16, 2024

Remove files

Files can be removed from a storage bucket using the 'remove' API. If a file is protected by an identity Id, only the user who owns the file will be able to remove it.

import { remove } from 'aws-amplify/storage';
try {
await remove({
path: 'album/2024/1.jpg',
// Alternatively, path: ({identityId}) => `album/{identityId}/1.jpg`
});
} catch (error) {
console.log('Error ', error);
}