Should public and private objects placed in same or different S3 bucket?

I’m working on a SaaS application. Currently we’re only storing public uploads in a bucket. For a new feature I need to store private files only accessible for specific users.

What would you say is best practice, having a separate bucket for all private objects or just one bucket with only specific folders/objects that are public?

Put them in a separate bucket. It costs you nothing and allows you to have a clear delineation of storage use cases and access controls.

Came here to say this.

Since there is zero additional cost, just keep them separate.

Regardless of the single- or multi-bucket approach that you decide to use, I wanted to make sure that you were aware of S3 Access Points. S3 APs are a way to manage access for different sets of users against data stored within a single bucket. With each AP, you get an additional custom hostname for your bucket, onto which you can apply a separate bucket policy.

https://aws.amazon.com/s3/features/access-points/

Separate. Disable public access at the bucket level for the private stuff and have a bit more confidence in it’s safety.

https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/

I agree with the other comments. I just want to add, there is seldom a reason to make a bucket public instead of just making the objects public. An object being public should be intentional.

I’ve got one client who took it a step further. All of their public buckets are in a dedicated “public bucket account” that hosts absolutely nothing else.

Agree. It allows for simple rules and that is good for security. Remember: “Complexity is the enemy of good security” -Bruce Schneier, schneier.com.

Also, I would imagine the OP knew the moment they asked :). Honestly, you can do it either way safely. One way is just much easier to manage and tag and all the things if you keep them a separate as possible.

(This wasn’t meant to be a reply)
Thanks y’all. Separate was what I was leaning to already but couldn’t really find best practices.

Thanks, will do just that.

That’s a damn good quote

Technically, it is possible to host both public and private objects in a single bucket because S3 does allow that level of granular control at object level. However, as many others already said, it is best to use separate buckets and keep things simple. Is there something that is limiting you to one bucket only?

If you hate yourself, put everything in the same bucket. Apply public access randomly to objects.

/s

Could also just make it all public and just use random names so people won’t know it exists. :ok_hand:t2:

And put a public access block on the private one.

Nah I can use how many I want really. So that’s what we’ll do.

As many people have said, separate buckets. However, have you thought about how you will ensure that the access controls aren’t later changed? I’d suggest using tags on the buckets to clearly document intent (such as whether it should be public or private), and a tool like Cloud Custodian to ensure that the private bucket isn’t accidentally made public.

Unless this is a scalable and not a one time thing, cause hard bucket limits

Have hit that before making this decision