Amazon S3 iOS SDK v2 Upload with AWSAccessKeyId:Signature


I’m trying to upload file on S3 bucket and device is getting access information from another server (AWSAccessKeyId and Signature). Is it possible to upload file with AWS iOS SDK v2? If not are there any chances to use another approach possible for iOS (eg. generate Pre-Signed URL and do the http post/put)?

Right now I’m using this approach, but it’s for access_key/access_secret:

I’ll be grateful for any ideas.


I recommend the following approach:

  • Generate the access key, secret key, and session token on your server. You have many language options including Java, .NET, PHP, Ruby, Python, and Node.js.
  • Implement your own credentials provider by conforming to AWSCredentialsProvider. This credentials provider should:
    • Retrieve the access key, secret key, and session key from your server.
    • Persist them until they expire.
    • Return the credentials when requested.
    • If they are expired, re-retrieve them from your server.
    • Calling refresh also should initiate the credentials retrieval process.
  • Assign your credentials provider to defaultServiceConfiguration or pass it to initWithConfiguration:.

As a side note, when using initWithConfiguration:, you need to manually retain a strong reference to an instance of AWSS3. Using defaultS3 will eliminate the need for this.

Hope this helps,

Leave a Reply