Using Path
You can now use the path parameter in the API to access any path within your S3 bucket. This provides more flexibility than the predefined protected, private, or guest folder access levels, allowing you to create and manage a storage structure tailored to your needs.
The sections below explain how to use existing guest, protected, and private resources with path-based APIs.
Using Guest accessLevel
import { getProperties } from 'aws-amplify/storage';
try { const result = await getProperties({ path: 'public/album/2024/1.jpg', }); console.log('File Properties ', result);} catch (error) { console.log('Error ', error);}Using Protected accessLevel
import { getProperties } from 'aws-amplify/storage';
try { const result = await getProperties({ // `identityId` will provide the ID of the currently authenticated user path: ({identityId}) => `protected/${identityId}/album/2024/1.jpg`, }); console.log('File Properties ', result);} catch (error) { console.log('Error ', error);}Using Private accessLevel
import { getProperties } from 'aws-amplify/storage';
try { const result = await getProperties({ // `identityId` will provide the ID of the currently authenticated user path: ({identityId}) => `private/${identityId}/album/2024/1.jpg`, }); console.log('File Properties ', result);} catch (error) { console.log('Error ', error);}