💻Common Interview Question Candidates get Wrong: S3 Security


Hello Reader,

In today’s post, let’s look at another correct but average answer and a great answer that gets you hired to common cloud interview questions. This question is critical because everyone uses this service in almost every project!

Question - How will you secure your S3 bucket?

Common but average answer

  • I will use KMS so bucket objects are not unencrypted
  • I will use Bucket Policy and IAm roles for least privilege to secure my bucket

What the interviewer is looking for is you understand different attack vectors and how to mitigate them. And there is one wrong statement in the above answer which I will explain. As an SA, you will be responsible for talking to the app team and coming up with an appropriate security strategy. We are looking to delight the interviewer and not meet.

A great answer is :

  • There are multiple ways a S3 bucket can be compromised, let's go one by one
  • Bad actors can access your bucket objects anonymously from internet. To stop that enable "Block Public Access" on the bucket
  • Even after public access is blocked, any authenticated AWS user can access my bucket. We don't want that in production. To prevent that, enforce bucket policies that allows only specific AWS service to access the bucket
  • From the other side, AWS Service need to have appropriate IAM role attached so they can access this bucket. It is important that the IAM role has least privilege access. Often , an IAM role has access to all S3 buckets. Ensure to use specific bucket name instead of "s3:*"
  • Most of the times application codes run inside a VPC in EC2 or Lambda. S3 bucket can NOT be brought inside VPC. To prevent traffic going through internet, use VPC Endpoint which enable traffic from the application code to the S3 bucket traverse through AWS private network and not via internet
  • This is a newer feature - after multiple security incidents, you can't have objects inside bucket unencrypted anymore. By default objects are encrypted using Server Side Encryption with S3 managed keys. You can switch to AWS Managed KMS, or Customer Managed KMS or newly released Dual Side KMS (cost more!). Hence never say that by default bucket objects are unencrypted. You can also do client side encryption before uploading the objects
  • Enforce encryption in transit by stopping insecure (HTTP) traffic inside bucket policy
  • Finally, it is possible that some security even happens. For that reason, always monitor and audit. Utilize CloudWatch and CloudTrail (this part everyone says). For production buckets also use AWS Config which can detect if configurations deviate from the established ones, notify groups, and fire a Lambda to auto remediate!

This approach of securing multiple attack vector is known as Defense in Depth. As in the attacker has to go through multiple layers to reach customer information in the S3 bucket. If you can mention first 4-5 points from the above, you'd delight the interviewer and set yourself apart from others.

💡 Other things to keep in mind

  • You can use S3 object lock to prevent accidental delete
  • Use Object versioning to retrieve deleted or manipulated objects
  • Avoid use simple bucket names

If you get this question in your interview, make sure to knock it out of the park!

P.S - If you want to get personally mentored by me and crack top tech jobs in AWS, Microsoft, Google, JPMC, reddit, CoreWeave etc., check out AWS SA Bootcamp with Live Classes, Mock Interviews, Hands-On, Resume Improvement and more: https://www.sabootcamp.com/​

Keep learning and keep rocking 🚀,

Raj

Fast Track To Cloud

Free Cloud Interview Guide to crush your next interview. Plus, real-world answers for cloud interviews, and system design from a top AWS Solutions Architect.

Read more from Fast Track To Cloud

Hello Reader, Often I hear this - API Gateway is Serverless, hence it's better than Application Load Balancer (ALB). In todays newsletter edition, we will take an objective look at both, consider pros and cons, and more importantly how to tackle this in system design or tech interview. Remember our guiding principle - to get the job, or to excel at the job - you need to DELIGHT and not just MEET the standard. Let's get started. Both can route traffic to backends, both are managed by AWS, and...

Hello Reader, In today’s post, let’s look at another correct but average answer and a great answer that gets you hired to common cloud interview questions. This question is even more relevant now, after this week's AWS outage! Question - How did you do Disaster Recovery (DR) for your AWS application? Common but average answer - I will replicate it to another region What the interviewer is looking for is how DR strategies are chosen, and what are the different strategies. As an SA, you will be...

Hello Reader, Recently, I had the privilege of speaking to the Computer Science and Business Club at Rutgers University - ranked #1 in New Jersey for Engineering and Computer Science by U.S. News & World Report. It was incredible to see how driven and curious these students were. Many already had offers from Amazon, JPMorgan, and other top companies. Talking with them took me right back to my college days - studying for exams, chasing grades, and trying to figure out how to land that first...