Name:
interface
Value:
Extend your Amplify Gen 2 app with AWS Blocks — self-contained backend capabilities you compose into your existing backend.

API Reference

copy

Copy an object from a source to a destination object within the same bucket.

Parameters

OptionRequiredTypeDescription
inputtrueStorageCopyInputWithPath
The CopyWithPathInput object.

Throws

  • service:S3Exception - Thrown when checking for existence of the object
  • validation:StorageValidationErrorCode - Thrown when source or destination path is not defined.

Returns

Promise<>
Output type with path for S3 copy API.

copy

Parameters

OptionRequiredTypeDescription
inputtrue
The CopyInput object.

Throws

  • service:S3Exception - Thrown when checking for existence of the object
  • validation:StorageValidationErrorCode - Thrown when source or destination key is not defined.

Returns

Promise<>
Output type with path for S3 copy API.

downloadData

Download S3 object data to memory

Parameters

OptionRequiredTypeDescription
inputtrue
The DownloadDataWithPathInput object.

Throws

  • service:S3Exception - thrown when checking for existence of the object
  • validation:StorageValidationErrorCode - Validation errors

Returns

Output type with path for S3 downloadData API.

downloadData

Parameters

OptionRequiredTypeDescription
inputtrue
The DownloadDataInput object.

Throws

  • service:S3Exception - thrown when checking for existence of the object
  • validation:StorageValidationErrorCode - Validation errors

Returns

Output type for S3 downloadData API.

getProperties

Gets the properties of a file. The properties include S3 system metadata and the user metadata that was provided when uploading the file.

Parameters

OptionRequiredTypeDescription
inputtrue
The GetPropertiesWithPathInput object.

Throws

  • AnS3Exception when the underlying S3 service returned error.
  • AStorageValidationErrorCode when API call parameters are invalid.

Returns

Promise<>
Output type with path for S3 getProperties API.

getProperties

Parameters

OptionRequiredTypeDescription
inputtrue
The GetPropertiesInput object.

Throws

  • AnS3Exception when the underlying S3 service returned error.
  • AStorageValidationErrorCode when API call parameters are invalid.

Returns

Promise<>
Output type for S3 getProperties API.

getUrl

Get a temporary presigned URL to download or upload the specified S3 object. The presigned URL expires when the associated role used to sign the request expires or the option expiresIn is reached. The expiresAt
property in the output object indicates when the URL MAY expire.
By default, it will not validate the object that exists in S3. If you set the options.validateObjectExistence to true, this method will verify the given object already exists in S3 before returning a presigned URL, and will throw StorageError if the object does not exist.

Parameters

OptionRequiredTypeDescription
inputtrue
The GetUrlWithPathInput object.

Throws

  • service:S3Exception - thrown when checking for existence of the object
  • validation:StorageValidationErrorCode - Validation errors thrown either username or key are not defined.

Returns

Promise<StorageGetUrlOutput>

getUrl

Parameters

OptionRequiredTypeDescription
inputtrue
The GetUrlInput object.

Throws

  • service:S3Exception - thrown when checking for existence of the object
  • validation:StorageValidationErrorCode - Validation errors thrown either username or key are not defined.

Returns

Promise<StorageGetUrlOutput>

list

List files in pages with the given path. pageSize is defaulted to 1000. Additionally, the result will include a nextToken if there are more items to retrieve.

Parameters

OptionRequiredTypeDescription
inputtrue
The ListPaginateWithPathInput object.

Throws

  • service:S3Exception - S3 service errors thrown when checking for existence of bucket
  • validation:StorageValidationErrorCode - thrown when there are issues with credentials

Returns

Promise<>
Output type with path for S3 list API. Lists bucket objects with pagination.

list

List all files from S3 for a given path. You can set listAll to true in options to get all the files from S3.

Parameters

OptionRequiredTypeDescription
inputtrue
The ListAllWithPathInput object.

Throws

  • service:S3Exception - S3 service errors thrown when checking for existence of bucket
  • validation:StorageValidationErrorCode - thrown when there are issues with credentials

Returns

Promise<>
Output type with path for S3 list API. Lists all bucket objects.

list

Parameters

OptionRequiredTypeDescription
inputfalse
The ListPaginateInput object.

Throws

  • service:S3Exception - S3 service errors thrown when checking for existence of bucket
  • validation:StorageValidationErrorCode - thrown when there are issues with credentials

Returns

Promise<>

list

Parameters

OptionRequiredTypeDescription
inputfalse
The ListAllInput object.

Throws

  • service:S3Exception - S3 service errors thrown when checking for existence of bucket
  • validation:StorageValidationErrorCode - thrown when there are issues with credentials

Returns

Promise<>

remove

Remove a file or folder from your S3 bucket.

Parameters

OptionRequiredTypeDescription
inputtrue
The RemoveWithPathInput object.

Throws

  • service:S3Exception - S3 service errors thrown while while removing the object.
  • validation:StorageValidationErrorCode - Validation errors thrown when there is no path or path is empty or path has a leading slash.

Returns

RemoveOperation<>

remove

Parameters

OptionRequiredTypeDescription
inputtrue
The RemoveInput object.

Throws

  • service:S3Exception - S3 service errors thrown while while removing the object
  • validation:StorageValidationErrorCode - Validation errors thrown when there is no key or its empty.

Returns

RemoveOperation<>

uploadData

Upload data to the specified S3 object path. By default uses single PUT operation to upload if the payload is less than 5MB. Otherwise, uses multipart upload to upload the payload. If the payload length cannot be determined, uses multipart upload.
Limitations: * Maximum object size is 5TB. * Maximum object size if the size cannot be determined before upload is 50GB.

Parameters

OptionRequiredTypeDescription
inputtrue
A UploadDataWithPathInput object.

Throws

  • S3Exceptionwhen the underlying S3 service returned error.
  • StorageValidationErrorCodewhen API call parameters are invalid.

Returns

Output type with path for S3 uploadData API.

uploadData

Upload data to the specified S3 object key. By default uses single PUT operation to upload if the payload is less than 5MB. Otherwise, uses multipart upload to upload the payload. If the payload length cannot be determined, uses multipart upload.
Limitations: * Maximum object size is 5TB. * Maximum object size if the size cannot be determined before upload is 50GB.

Parameters

OptionRequiredTypeDescription
inputtrue
A UploadDataInput object.

Throws

  • S3Exceptionwhen the underlying S3 service returned error.
  • StorageValidationErrorCodewhen API call parameters are invalid.

Returns

Output type for S3 uploadData API.

Link Color Legend

Interface
Reference
Other