Keeping Your Data Private
Buckets are private by default. Here's how to keep it that way and share safely when you need to.
1 min read
New buckets are private, have Block Public Access turned on, and encrypt new objects automatically (SSE-S3). Most S3 data leaks happen when someone deliberately turns these protections off.
Four tools for controlling access
- IAM policies: attached to a user or role. "This Lambda role may read
notesnap-uploads." - Bucket policies: attached to the bucket. "Deny any upload that isn't sent over HTTPS."
- Block Public Access: a master switch that overrides any policy that would make data public. Leave it on.
- Presigned URLs: a temporary link to one object, for sharing without making anything public (see the hands-on lesson).
Watch out
If you need a public website, don't make the bucket public. Put CloudFront in front of a private bucket instead. You get HTTPS, caching, and your bucket stays locked down.
Encryption
- SSE-S3 (the default): AWS manages the keys. Zero effort.
- SSE-KMS: you manage keys in AWS KMS, with audit logs of every use. Common for regulated data.
- 1Request arrives
e.g. GetObject
- 2Block Public Access
Anonymous? Blocked.
- 3IAM + bucket policy
Explicit deny wins
- 4Allowed
Object returned
Key takeaways
- Buckets start private, with Block Public Access on and encryption enabled.
- Use IAM policies for identities, and bucket policies for rules about the bucket itself.
- Share with presigned URLs or CloudFront, not by making buckets public.
Check your understanding
Pick an answer to see the explanation.
1. You want to let a customer download one invoice for the next 15 minutes. What do you use?