AWS for developers · senior
Choosing the database and the region
Start from access patterns, consistency and scale, then pick the database. For Indian products also decide the region by latency, data rules and disaster recovery.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- List access patterns, consistency needs, reporting needs, expected scale and what the team knows before you name a database.
- DynamoDB for a wallet: partition key USER#<id>, sort key TXN#<timestamp>#<id>. Query newest first with a limit and page with LastEvaluatedKey. Other lookups need a GSI designed up front. There are no joins or ad-hoc queries.
- Balance safety in DynamoDB: a conditional update (balance >= :amount), TransactWriteItems to write the transaction and balance together, and a condition on the transaction id for idempotency.
- In PostgreSQL: UPDATE wallets SET balance = balance - $1 WHERE id = $2 AND balance >= $1 inside a transaction with a ledger insert and a unique idempotency key. Joins, reports and flexible queries come free.
- Mumbai (ap-south-1, three Availability Zones) gives the lowest latency for most Indian users. Hyderabad (ap-south-2, opened in November 2022) is the second region inside India.
- RBI's 2018 rule: payment system data must be stored only in India, and if processed abroad it must come back within a day. SEBI and IRDAI have their own rules. The DPDP Act allows transfers abroad except to countries the government restricts. Ask legal for the exact rules for your product.
- Plan Multi-AZ first, which covers most failures. Then disaster recovery to Hyderabad: cross-region backups, a cross-region read replica, S3 replication, with RPO and RTO agreed with the business.
- New services and features often arrive in other regions first, so check availability before you plan.
The red pen
Common traps: mistake → fix
Mistake: DynamoDB is faster so it is better for everything
Fix: It is great for known access patterns and weak for ad-hoc queries.
Mistake: Multi-AZ is disaster recovery across regions
Fix: Multi-AZ survives a zone failure. A region failure needs a second region.
Mistake: Data residency is only about where I store data
Fix: It also covers where data is processed.
Easy to hard
Questions interviewers ask, easy to hard
- How do you choose between RDS and DynamoDB for a wallet service?
- Design a DynamoDB table for wallet transactions.
- How do you prevent a wallet balance from going negative in each database?
- Which AWS region would you use for an Indian product and why?
- How would you plan disaster recovery for a payments service in India?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.