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

Don't force public/ and private/ prefixes for S3 keys #332

Closed
ffxsam opened this issue Feb 21, 2018 · 9 comments
Closed

Don't force public/ and private/ prefixes for S3 keys #332

ffxsam opened this issue Feb 21, 2018 · 9 comments
Labels
Storage Related to Storage components/category

Comments

@ffxsam
Copy link
Contributor

ffxsam commented Feb 21, 2018

There should be a way to not use the public/ and private/<region>:<uuid>/ prefixes. This removes control from the developer.

I'm also confused as to why the region is included in the path. Does it have some sort of effect on how data is stored in S3?

@mlabieniec
Copy link
Contributor

@ffxsam public and private prefixes are used mainly for notation around the permission level you decide i.e. Storage.configure( { level: 'private' } ).

Also, the region actually isn't added by us, this is the Cognito Identity ID, so essentially the user ID, and it allows for a sort of multi tenancy among the private files, so think of it like /private/me/... kinda like a home directory type of thing.

If we didn't use public/private prefixes, it may be difficult for the rest of the storage library to interact or enforce permissions. I'm no exactly sure how we would easily enforce permissions if we didn't use the prefix in S3, since S3 is object storage, the prefix allows us to easily enforce this permission. Let me know what you think.

@ffxsam
Copy link
Contributor Author

ffxsam commented Feb 22, 2018

Ahh, I guess I'm not informed on what the bigger picture of this library will be and how all the pieces fit together. I was under the impression that Amplify is basically a high-level wrapper around Cognito and related services. Is there something else in the library that depends on S3 storage using the prefixes like that?

@sdeby
Copy link

sdeby commented Feb 28, 2018

Can you make the prefixes configurable? This would make life easier for existing projects.

@mlabieniec
Copy link
Contributor

I think making them configurable would be a pretty simple thing here, @ffxsam would this help in your use case?

@ffxsam
Copy link
Contributor Author

ffxsam commented Feb 28, 2018

Very much so, yes! I think locking people in to using /public and /private/{region}:{uuid} folders is probably not a good idea. We need flexibility & configurability.

@mlabieniec
Copy link
Contributor

Great, I'll add this to our backlog.

@rzubrycki
Copy link

@mlabieniec @ffxsam Hi guys, how can i save files in the root of the bucket? I don't need prefix at all.

@nishantWM
Copy link

Found a way to do this,

let result = await Storage.put('folderName/imageName.png', blob, {
  contentType: 'image/jpeg',
    customPrefix: {
       public:''
    }
 });

This saves the file in the root of the bucket, inside folder "folderName".

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Storage Related to Storage components/category
Projects
None yet
Development

No branches or pull requests

7 participants