Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple buckets? #329

Open
ffxsam opened this issue Feb 21, 2018 · 10 comments

Comments

Projects
10 participants
@ffxsam
Copy link
Contributor

commented Feb 21, 2018

In the documentation examples:

Amplify.configure(
    Auth: {
        identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', //REQUIRED - Amazon Cognito Identity Pool ID
        region: 'XX-XXXX-X', // REQUIRED - Amazon Cognito Region
        userPoolId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito User Pool ID
        userPoolWebClientId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito Web Client ID
    },
    Storage: {
        bucket: '', //REQUIRED -  Amazon S3 bucket
        region: 'XX-XXXX-X', //OPTIONAL -  Amazon service region
    });

What if the web app needs to interact with more than one bucket? It would be nice to have a system where we could specify several and interact with them via their names.

    Storage: {
      bucketOne: {
        bucket: '', //REQUIRED -  Amazon S3 bucket
        region: 'XX-XXXX-X', //OPTIONAL -  Amazon service region
      },
      bucketTwo: { ... }
    });

@mlabieniec mlabieniec removed the enhancement label Apr 2, 2018

@mlabieniec mlabieniec added this to Backlog in aws-amplify via automation Apr 13, 2018

@mlabieniec mlabieniec added this to the aws-amplify@0.5 milestone Apr 13, 2018

@tim-thompson

This comment has been minimized.

Copy link

commented Jul 5, 2018

Don't know what the progress on this has been but as it is still open thought I would comment.
I had this same restriction today and after some digging found that it is possible to pass a bucket option into various calls as follows:

Storage.vault.get(key, {bucket: 'alternative-bucket-name'});

Using this I've managed to successfully use multiple buckets in the same app. If it is not specified then it defaults back to the bucket in the global configuration for Amplify.

@mlabieniec mlabieniec removed this from the aws-amplify@0.5 milestone Jul 19, 2018

@jnreynoso

This comment has been minimized.

Copy link

commented Sep 27, 2018

Hi, what is valud @tim-thompson ? Storage.vault

@annjawn

This comment has been minimized.

Copy link

commented Nov 8, 2018

Is there any update on this? Support for multiple buckets is a really desirable feature.

@tim-thompson

This comment has been minimized.

Copy link

commented Nov 8, 2018

@annjawn I posted a solution further up this page that works for all my scenarios. If you need more info then I've written about it on my blog in more detail - http://tim-thompson.co.uk/aws-amplify-multiple-buckets.

@annjawn

This comment has been minimized.

Copy link

commented Nov 9, 2018

@tim-thompson i have tried the storage.vault method but it did not work for me for some reason. Also, it looks like only get works with storage.vault however the code suggests otherwise. I've found a solution btw. I am doing storage.config() before each operation by setting the appropriate bucket name. It's less than efficient, but it's getting the job done.

@rizerzero

This comment has been minimized.

Copy link

commented Nov 13, 2018

@annjawn Hi, do you have a blog post on your method ? thanks in advance 👍

@10ky

This comment has been minimized.

Copy link

commented Dec 2, 2018

If you are able to get content off of a bucket using this statement:

Storage.vault.get(key, {bucket: 'alternative-bucket-name'});

It would be a security issue. Unless you allow it in an IAM role attached the a user. I believe amplify uses this role "s3_amplify_...". This role should be modified automatically according to your aws-exports.js file when you do amplify push. I don't see how the above statement would affect "amplify push".

@10ky

This comment has been minimized.

Copy link

commented Dec 2, 2018

@mlabieniec is this feature request removed from the aws-amplify milestone on Jul 19? I thought this is a good feature to have. I think I have a use case where all my resized photos in S3 can be in a separate bucket. Right now, the S3image and album library resizes photo at the client side. If my photo files are very large, that would not be desirable. If the resize file is put in the same directory as in the private user directory, a lambda trigger would not work because S3 trigger does not support regular expression prefix match.

@ngocketit

This comment has been minimized.

Copy link

commented Jan 14, 2019

It would be very convenient to have this supported. Currently, I have to call Amplify.configure() with new bucket every time I want to do something with non-default bucket.

@hoang-innomizetech

This comment has been minimized.

Copy link

commented Mar 28, 2019

We are also looking for this feature, we are building an app that requires access to multiple buckets, so it would be better if we don't have to specify the bucket when configuring amplify (or we can use default bucket), some APIs also need to allow us specify bucket such as get pre-signed url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.