Volume 13 · Chapter 3 — Mock Interviews and Rapid-Fire Revision

Mock Interview: Security, Compute and Data

Goutham Mayaluri 7 min read AWSCloudSecurity

3.1 Introduction

This mock interview covers identity and security, compute and containers, and storage and databases - the core technical middle of an AWS interview. As before, read each question, answer aloud, then compare with the model, watching for the direct-answer-then-reasoning-then-trade-offs structure.

Mock Interview

Why are IAM roles preferred over users with access keys, and what's the evaluation rule?

Roles are preferred because they provide temporary, auto-expiring credentials via STS with nothing long-lived to leak. A workload gets a role and automatically receives rotating credentials, so no access keys sit in code or config - eliminating the most common breach source - and people assume roles via single sign-on with MFA for temporary, scoped access. Long-lived keys leak into source control, logs, and backups and are rarely rotated, so removing them is the highest-impact security practice. The permission evaluation rule is: implicit default deny, an explicit Allow grants, and an explicit Deny overrides everything - explicit deny always wins. That’s what makes guardrails enforceable: an organization service control policy that denies disabling encryption or creating public buckets can’t be overridden by any account-level allow, so it’s a hard limit. So roles remove stored secrets and the deny-wins rule lets you impose unbreakable org-wide guardrails - both foundational to securing a bank on AWS.

Mock Interview

Explain KMS envelope encryption and why data-at-rest encryption also acts as an access boundary.

KMS manages encryption keys that never leave the service in plaintext, and it uses envelope encryption for efficiency: rather than sending data to KMS, you request a data key, and KMS returns a plaintext data key plus an encrypted copy; you encrypt the data locally with the plaintext key, store the encrypted data key alongside the data, and discard the plaintext key. To decrypt, you send the encrypted data key back to KMS, which returns the plaintext key if you’re authorized. The master key stays in KMS, large data isn’t shipped to it, and the plaintext data key exists only briefly. It acts as an access boundary because using a KMS key is governed by the key’s policy, so decrypting requires explicit permission to use that key - meaning someone who reaches the encrypted data still can’t read it without key permission. So a bank encrypting a statements bucket with a customer-managed key grants decrypt permission only to the specific application roles, and the data is protected even against someone who gains bucket access - encryption becomes a second, independent access control.

Mock Interview

When would you use EC2, containers, or serverless, and what makes each scale?

I match the compute model to the workload. EC2 when I need full OS-level control - a legacy app or specific runtime - accepting responsibility for the OS and patching; it scales by running instances in an Auto Scaling group across AZs behind a load balancer, adding stateless instances with demand. Containers (ECS or EKS) for portable microservices at scale - packaging apps consistently and orchestrating them with self-healing, scaling, and rolling updates, on Fargate to avoid managing nodes; they scale by adding container replicas and health-gating traffic. Serverless (Lambda) for event-driven, spiky, or intermittent work - it scales automatically per request and costs nothing when idle, so it’s ideal for reacting to events, but not for long-running processes, steady high throughput, or ultra-low-latency paths sensitive to cold starts. The common thread is statelessness: state lives in external stores so any instance, container, or function handles any request, enabling horizontal scaling. So I’d use serverless for event-driven glue, containers for the microservices core, and EC2 where I need control - choosing deliberately rather than defaulting, and keeping everything stateless to scale out.

Mock Interview

How do you choose between a relational database and DynamoDB?

I choose based on the workload’s access pattern, consistency needs, and scale. I use a relational database - RDS or Aurora - when I need complex queries and joins, flexible ad-hoc querying, strong relational integrity, and multi-row ACID transactions, which is why a bank’s core account and transaction ledger is relational: it demands those transactional guarantees. I use DynamoDB when I need massive scale and consistent low latency with simple, well-defined key-based access - sessions, profiles, high-volume events - where predictable performance at scale matters more than query flexibility. The key design difference is that relational modelling models normalized entities and queries them flexibly afterward, while DynamoDB requires designing the keys around your access patterns up front, because it’s optimized for key-based access rather than arbitrary queries. Many systems use both - a relational system of record plus DynamoDB for high-scale simple-access parts. So the decision is workload-driven: relational for complex queries, joins, and ACID integrity; DynamoDB for scale, low latency, and simple key access - matching each workload to the right store rather than forcing one model everywhere.

Mock Interview

How do you guarantee a money transfer is correct under concurrency, failure, and retries?

Three things together: ACID transactions, concurrency control, and idempotency. I wrap the transfer in a single ACID transaction on a relational system of record, so the debit and credit are atomic - both commit or neither - and durable, surviving crashes, and I confirm to the customer only after commit. I handle concurrency with appropriate isolation and locking - pessimistic row locking or optimistic concurrency - so two transfers on the same account can’t interleave and corrupt the balance, avoiding the classic race condition. And I make the operation idempotent with an idempotency key, because in a distributed system requests get retried and messages redelivered, so the same transfer can arrive more than once, and a retried “transfer $100” must not become $200 - the key ensures it’s applied exactly once. If the operation spans services I keep them consistent with the outbox pattern - the event written in the same transaction as the ledger update - and idempotent consumers, and the authoritative balance always comes from the ACID ledger, never a cache. So ACID for atomic durable movement, isolation and locking against concurrency corruption, and idempotency for safe retries - the non-negotiable foundation for handling money correctly.

Mock Interview

How do S3 storage classes and security prevent both runaway cost and data leaks?

On cost, S3 offers storage classes at different price-and-access trade-offs - Standard, infrequent-access, and archival - and lifecycle policies automatically transition aging objects to cheaper classes and expire them. Since most data cools over time - a statement is read a lot at first, rarely later - lifecycle tiering keeps years of compliance data affordable by moving cold data to cheap storage automatically instead of paying Standard prices for it. On security, the infamous public-bucket leak is a customer misconfiguration - people assume AWS keeps data private, but access configuration is the customer’s responsibility - so I prevent it by blocking public access at the account and bucket level (on by default, kept on), granting access only through tightly-scoped IAM and bucket policies, encrypting objects with KMS (which also acts as an access boundary), requiring TLS, and logging access, with an organization guardrail denying public buckets as a backstop. For compliance data I add versioning and object lock for immutability. So lifecycle tiering controls cost by matching storage class to access frequency, and block-public-access plus least-privilege policies and encryption make the classic leak essentially impossible.

3.7 Chapter Revision Notes

  • Roles give temporary credentials (no stored keys to leak); evaluation is implicit-deny → allow → explicit-deny-wins, which makes SCP guardrails unbreakable.
  • Envelope encryption keeps the master key in KMS; key-policy-governed decryption makes encryption an independent access boundary.
  • EC2 for OS control, containers for portable microservices, serverless for event-driven spiky work - all scaled statelessly and horizontally.
  • Relational for complex queries/joins/ACID; DynamoDB for scale + low latency + simple key access (design keys around access patterns).
  • Money correctness = ACID transactions + isolation/locking + idempotency; S3 cost via lifecycle tiering, security via block-public-access + least privilege + encryption.