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

Page updated Feb 21, 2024

LegacyYou are viewing Gen 1 documentation. Switch to the latest Gen 2 docs →

Use AWS SDK

For advanced use cases where Amplify does not provide the functionality, you can retrieve the escape hatch to access the AWSS3 instance.

Add the following import:

import AWSS3StoragePlugin

Then retrieve the escape hatch with this code

do {
// Retrieve the reference to AWSS3StoragePlugin
let plugin = try Amplify.Storage.getPlugin(for: "awsS3StoragePlugin")
guard let storagePlugin = plugin as? AWSS3StoragePlugin else {
return
}
// Retrieve the reference to S3Client
let s3Client = storagePlugin.getEscapeHatch()
// Make requests using s3Client...
// ...
} catch {
print("Get escape hatch failed with error - \(error)")
}

For additional client documentation, see the AWS SDK for Swift Client documentation. For S3Client code examples, see the Amazon S3 examples using SDK for Swift