Page updated Nov 12, 2023


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

Note: While the Amplify Library for Swift is production ready, please note that the underlying AWS SDK for Swift is currently in Developer Preview, and is not yet intended for production workloads. Here is additional reading material on the stability of the SDK

Add the following import:

1import AWSS3StoragePlugin

Then retrieve the escape hatch with this code

1do {
2 // Retrieve the reference to AWSS3StoragePlugin
3 let plugin = try Amplify.Storage.getPlugin(for: "awsS3StoragePlugin")
4 guard let storagePlugin = plugin as? AWSS3StoragePlugin else {
5 return
6 }
8 // Retrieve the reference to S3Client
9 let s3Client = storagePlugin.getEscapeHatch()
11 // Make requests using s3Client...
12 // ...
13} catch {
14 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