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

Page updated May 2, 2024

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

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.

Note: path parameter can not be empty or start with a '/' (leading slash)

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);
}