I am developing a android app using AWS as a cloud backend. There is a need where I need to access two different S3 buckets in my android app. AS per the official document AWS recommends to use Amplify framework for android AWS integration. But I can't find any details in the official document https://docs.amplify.aws/lib/storage/getting-started/q/platform/android#provision-backend-storage as to how add/access multiple S3 bucket in a single android application using Amplify.
Asked
Active
Viewed 802 times
2
-
1Are you asking for a way to have Amplify create and manage multiple S3 Buckets for your app so that you can interact with them from your app front end? If so, I can provide an answer that works perfectly. There is undocumented storage function parameters that allow you to name a storage bucket, and there is a straightforward process to add several storage buckets and have amplify create/manage them. Let me know. – Sinux1 Jul 14 '21 at 23:34
-
@Sinux1 please add this answer I need to upload to 2 different buckets in one app – Uriel Frankel Mar 22 '23 at 10:19
-
@UrielFrankel It has been awhile since I left this comment, lol. I will have to get some stuff together for detailed explanation, but in short without knowing much else about your app - you can use the custom category for 1 or both S3 buckets, make sure they output their names and Arns. Add a post push script that parses your amplify-meta.json file and generates reactapp environment variables for the project (maybe creating yourself a local dot env file). Then in your code, use the appropriate environment variables. When you build, the environment variable values will be used.... – Sinux1 Mar 28 '23 at 21:24
-
@UrielFrankel After giving it some thought, if I was to be in this situation today, I would combine my two books into a single bucket, and I would use 2 different top-level prefixes, applying whatever permissions on the original 2 buckets to the 2 new prefixes, respectfully. – Sinux1 Mar 29 '23 at 03:27
1 Answers
1
Amplify Android doesn't support this, right now. If you'd like to see the functionality added, please log a feature request on the project's GitHub repository.
Here are a few alternatives:
Create a third bucket, specifically for your mobile app. Copy/combine the content from your other two buckets into this new bucket. Optionally, set up an even trigger on the source buckets, to automatically copy stuff into the mobile bucket, when new content is added to the source bucket.s
Directly use the
AmazonS3Client
from the AWS Mobile SDK, instead.

Jameson
- 6,400
- 6
- 32
- 53