Ravindra BagaleCourses & study guides Track your progress

AWS Cloud

AWS Database Interview Questions and Answers: RDS, Aurora, DynamoDB and ElastiCache (50 Questions)

This page has 50 new AWS database interview questions with full answers. It covers relational databases on RDS and Aurora, NoSQL on DynamoDB, caching on ElastiCache and real production scenarios.

1. An everyday example: a library

Data is the most valuable part of any system. Interviewers want to see that you can pick the right database, keep it available, back it up, and make it fast without wasting money.

Think of a city library. RDS is a library where AWS hires the staff for cleaning, repairs and backups, but you still decide how books are arranged. Multi-AZ is a second library building kept ready in case the first one closes. Read replicas are extra reading rooms with copies of the books. DynamoDB is a giant locker system: give the exact locker number (the key) and you get your item in milliseconds. ElastiCache is the "most popular books" shelf near the door.

How to use this page

  • For every "which database" question, start with the access pattern and the consistency need.
  • Learn the key DynamoDB maths: 1 RCU and 1 WCU sizes.
  • Say how you would test failover and restore, not only how you would configure them.

2. Fresher level questions

Start here if you are a fresher or have less than two years of experience. Try to answer each question aloud first. Then open it and compare.

Q1. What is Amazon RDS and what does AWS manage for you? Fresher

Amazon RDS (Relational Database Service) is a managed service for relational databases such as MySQL, PostgreSQL, MariaDB, Oracle, SQL Server and Db2.

AWS manages hardware, OS installation, database installation, patching in maintenance windows, automated backups, monitoring basics and Multi-AZ failover.

You still manage the schema, queries, indexes, users, parameter settings, security groups and choosing the instance size.

You do not get SSH access to the host for normal RDS.

Q2. Can an RDS Multi-AZ standby serve read traffic, and when do you need a read replica instead? Fresher

Multi-AZ is for high availability. RDS keeps a standby copy in another Availability Zone with synchronous replication. If the primary fails, RDS fails over to the standby automatically. In the classic Multi-AZ instance setup, the standby does not serve reads.

A read replica is for read scaling. It uses asynchronous replication, so it can lag a little. Apps can send read queries to it. You can also promote a replica to a standalone database, for example for DR in another Region.

Q3. What happens to RDS automated backups and manual snapshots when you restore or delete a database? Fresher

Automated backups take a daily snapshot and save transaction logs. You can restore to any second within the retention period, which can be up to 35 days. They are deleted when the retention ends.

Manual snapshots are taken when you choose. They stay until you delete them, even if the database is deleted.

A restore always creates a new database instance with a new endpoint. You then point the app to it.

Q4. What is Amazon Aurora? Fresher

Aurora is AWS's cloud-built relational database, compatible with MySQL and PostgreSQL.

Its storage is shared and distributed. Data is stored as six copies across three Availability Zones, and storage grows automatically.

An Aurora cluster has one writer and up to 15 Aurora Replicas that share the same storage. Because replicas share storage, replica lag is usually low and failover is fast.

Q5. What is Amazon DynamoDB? Fresher

DynamoDB is a fully managed, serverless NoSQL key-value and document database.

It gives single-digit millisecond performance at almost any scale. There are no servers to patch and no storage to size.

You design tables around access patterns. Each item is found by its primary key. Data is stored across multiple Availability Zones in a Region.

Common uses: user profiles, shopping carts, sessions, gaming leaderboards and IoT data.

Q6. How do the partition key and sort key work together in a DynamoDB composite primary key? Fresher

The partition key decides which internal partition stores the item. DynamoDB hashes its value.

The sort key is optional. Items with the same partition key are stored together and ordered by the sort key.

Example: in an Orders table, CustomerId is the partition key and OrderDate is the sort key. Then you can quickly get all orders of one customer, sorted by date, or only orders from last month.

Together they form the composite primary key, which must be unique.

Q7. Why does a DynamoDB Scan become slow and costly as the table grows, while a Query stays fast? Fresher

Query finds items using the partition key, and optionally a condition on the sort key. It reads only the matching items, so it is fast and cheap.

Scan reads every item in the table or index and then filters. It becomes slow and expensive as the table grows.

Filter expressions are applied after reading, so they do not reduce the capacity used.

Rule: design keys and indexes so your common reads are Queries, and use Scan only for rare jobs like exports.

Q8. What is the maximum item size in DynamoDB? Fresher

A single item can be up to 400 KB. This includes attribute names and values.

If you need to store bigger data, such as images or large documents, put the data in S3 and store only the S3 key and metadata in DynamoDB.

Keep attribute names short in very large tables, because names count toward size and capacity use.

Q9. What are on-demand and provisioned capacity modes in DynamoDB? Fresher

On-demand: you pay per read and write request. DynamoDB handles scaling. Good for new apps, unknown or spiky traffic.

Provisioned: you set read and write capacity units, optionally with auto scaling. You pay for the capacity per hour. Good for steady, predictable traffic, and usually cheaper at high steady use. Reserved capacity can lower it further.

You can switch modes, with some limits on how often.

Q10. What is Amazon ElastiCache? Fresher

ElastiCache is a managed in-memory data store for caching. It supports Valkey, Redis OSS and Memcached engines.

Reads from memory take less than a millisecond, so caching popular data reduces load on the database and speeds up the app.

Common uses: database query cache, session store, leaderboards, rate limiting and pub/sub messaging.

Valkey and Redis OSS support replication, persistence options and data structures. Memcached is simple and multithreaded, with no replication.

Q11. What is a DB subnet group in RDS? Fresher

A DB subnet group is a list of subnets in your VPC, in at least two Availability Zones, where RDS may place the database.

RDS uses it to choose subnets for the primary and the Multi-AZ standby.

Best practice: use private subnets with no route to the internet. Allow access only from the app tier's security group on the database port.

Q12. What is the RDS endpoint and why should apps not use an IP address? Fresher

RDS gives every database a DNS endpoint, such as shopdb.abcdefghijkl.ap-south-1.rds.amazonaws.com.

During a Multi-AZ failover, RDS updates the DNS record to point to the new primary. If an app uses the IP address, it will keep connecting to the old, failed host.

So always connect using the endpoint name, and keep the client's DNS cache time short so it picks up the change quickly.

Q13. What is a parameter group in RDS? Fresher

A parameter group holds database engine settings, such as max_connections, time zone or slow query logging.

The default group cannot be changed. Create a custom group, edit it, and attach it to your database.

Dynamic parameters apply at once. Static parameters need a reboot.

Option groups are different. They enable extra features for some engines, such as Oracle or SQL Server options.

Q14. What is the difference between eventually consistent and strongly consistent reads in DynamoDB? Fresher

Eventually consistent read: may not show a write made a moment ago, but usually catches up within a second. It costs half as much: one RCU gives two such reads per second of up to 4 KB.

Strongly consistent read: always returns the latest committed data. It uses one full RCU per 4 KB.

Default is eventually consistent. Global secondary indexes support only eventually consistent reads.

Q15. How do you list RDS instances and their status with the CLI? Fresher

Use describe-db-instances with a query.

aws rds describe-db-instances --query "DBInstances[].{id:DBInstanceIdentifier,engine:Engine,class:DBInstanceClass,multiAZ:MultiAZ,status:DBInstanceStatus}" --output table

Output:

-----------------------------------------------------------------
|                     DescribeDBInstances                       |
+--------------+-----------+-------------+-----------+----------+
|    class     |  engine   |     id      |  multiAZ  | status   |
+--------------+-----------+-------------+-----------+----------+
|  db.t4g.micro|  postgres |  shop-dev   |  False    | available|
|  db.r7g.large|  postgres |  shop-prod  |  True     | available|
+--------------+-----------+-------------+-----------+----------+

production uses Multi-AZ and a memory-optimised class, while dev uses a small single-AZ instance to save cost.

Q16. What is Amazon Redshift used for? Fresher

Redshift is a data warehouse for analytics on large amounts of structured and semi-structured data.

It stores data in columns and runs queries in parallel across nodes, so reports over billions of rows run fast.

It is used for business intelligence dashboards and reports, not for an app's day-to-day transactions.

Options include provisioned clusters and Redshift Serverless. Redshift Spectrum can query data directly in S3.

Q17. What is AWS DMS? Fresher

AWS Database Migration Service moves data from a source database to a target with minimal downtime.

It does a full load first and then change data capture (CDC), copying ongoing changes until you cut over.

It supports same-engine moves, such as MySQL to RDS MySQL, and different engines, such as Oracle to PostgreSQL. For different engines, schema conversion is needed, using DMS Schema Conversion or the AWS Schema Conversion Tool.

3. Mid level questions

These questions check how you use the service in real projects. Interviewers expect the why, the how and one real example.

Q18. How do you calculate RCUs and WCUs for a DynamoDB table? Mid level

Rules:

  • 1 RCU = one strongly consistent read per second of an item up to 4 KB, or two eventually consistent reads.
  • 1 WCU = one write per second of an item up to 1 KB.
  • Sizes round up. Transactional reads and writes cost double.

Example: 100 strongly consistent reads per second of 6 KB items. 6 KB rounds up to 8 KB, which is 2 RCU per read. So 200 RCU. For eventually consistent reads, 100 RCU.

Example: 50 writes per second of 2.5 KB items. 2.5 KB rounds to 3 KB, so 150 WCU.

Q19. When must you create an LSI, and why do most new DynamoDB designs use a GSI instead? Mid level

A global secondary index (GSI) can have a different partition key and sort key from the table. You can add it at any time. It has its own capacity and supports only eventually consistent reads. The default quota is 20 GSIs per table.

A local secondary index (LSI) has the same partition key but a different sort key. You must create it when you create the table. It supports strongly consistent reads. You can have up to 5. Tables with an LSI have a 10 GB limit per partition key value (item collection).

Most new designs use GSIs.

Q20. Why can one popular partition key throttle a DynamoDB table, and how do you fix it? Mid level

A hot partition happens when too many requests go to the same partition key, such as one popular product or today's date as the key.

DynamoDB partitions have throughput limits, so these requests get throttled even if the table has spare capacity.

Fixes:

  • Choose a high-cardinality key, such as UserId instead of Country.
  • Add a random or calculated suffix (write sharding), such as Date#1 to Date#10, and query all shards when reading.
  • Cache hot reads with DAX or ElastiCache.

Adaptive capacity helps, but it does not fix a bad key design.

Q21. Why can expired DynamoDB TTL items still appear in query results? Mid level

Time to Live lets DynamoDB delete items automatically after a time.

You pick a numeric attribute, such as expireAt, and store an epoch time in seconds. After that time passes, DynamoDB deletes the item in the background without using your write capacity.

Deletion is not exact. AWS says expired items are typically deleted within a few days, so filter out expired items in your queries if exactness matters.

TTL deletes appear in DynamoDB Streams, so you can archive items to S3 before they disappear.

Q22. What are DynamoDB Streams used for? Mid level

A stream records item-level changes: inserts, updates and deletes, in order for each item. Records are kept for 24 hours.

You choose the view type: keys only, new image, old image, or both.

Common uses with Lambda: update a search index, send a notification when an order changes, aggregate counters, or replicate data to another system.

Make the consumer idempotent, because records can be processed more than once after retries.

Q23. How do conditional writes and optimistic locking work in DynamoDB? Mid level

A conditional write succeeds only if a condition is true. Otherwise it fails with ConditionalCheckFailedException.

Optimistic locking uses a version number:

  • Read the item with version 7.
  • Update it with condition "version = 7" and set version to 8.
  • If someone else updated it first, the version is now 8, so your write fails. You read again and retry.

This prevents lost updates without locks. Use attribute_not_exists(pk) to make sure you do not overwrite an existing item.

Q24. What are DynamoDB transactions? Mid level

Transactions let you change several items, even across tables, as all-or-nothing.

TransactWriteItems can include up to 100 actions, such as Put, Update, Delete and ConditionCheck.

Example: book a seat. Check the seat is free, mark it booked, and create the booking record in one transaction. If any condition fails, nothing changes.

Transactions cost twice the capacity of normal operations, so use them only where you need atomic changes.

Q25. What is DynamoDB Accelerator (DAX)? Mid level

DAX is an in-memory cache built for DynamoDB. It is API-compatible, so apps use the DAX client with few code changes.

It reduces read time from milliseconds to microseconds for cached items and reduces read load on the table.

It works best for read-heavy apps with repeated reads of the same items. It does not help write-heavy workloads, and reads from DAX are eventually consistent. Strongly consistent reads pass through to DynamoDB.

Q26. What is RDS Proxy and when should you use it? Mid level

RDS Proxy is a managed connection pooler for RDS and Aurora.

Why: apps like Lambda can open thousands of short connections. Each database connection uses memory, and the database can hit max_connections and fail.

RDS Proxy keeps a pool of database connections and shares them. It also makes failover faster for apps, because it keeps client connections open while it reconnects to the new primary.

It can use IAM authentication and read credentials from Secrets Manager.

Q27. What are Aurora endpoints? Mid level

Aurora gives several DNS endpoints:

  • Cluster (writer) endpoint: always points to the current writer. Use it for writes.
  • Reader endpoint: spreads connections across Aurora Replicas. Use it for reads.
  • Custom endpoints: point to a chosen group of instances, for example bigger replicas for reports.
  • Instance endpoints: one specific instance, mainly for troubleshooting.

After a failover, the cluster endpoint automatically points to the new writer.

Q28. What is Aurora Serverless v2? Mid level

Aurora Serverless v2 automatically scales database capacity up and down in small steps, measured in Aurora Capacity Units (ACUs).

You set a minimum and a maximum ACU. Capacity changes in seconds based on load.

You can mix serverless and provisioned instances in one cluster, for example a provisioned writer and serverless readers.

Good for variable or unpredictable workloads, dev and test databases, and multi-tenant apps. For steady heavy load, provisioned instances can be cheaper.

Q29. How do you encrypt an existing unencrypted RDS database? Mid level

You cannot turn on encryption directly for an existing unencrypted instance.

Steps:

  • Take a snapshot of the database.
  • Copy the snapshot and choose encryption with a KMS key.
  • Restore a new database from the encrypted snapshot.
  • Point the app to the new endpoint during a maintenance window.

To reduce downtime, you can use AWS DMS or native replication to keep the new encrypted database in sync until cutover.

Q30. What is the difference between lazy loading and write-through caching? Mid level

Lazy loading (cache-aside): the app reads the cache first. On a miss, it reads the database and writes the result to the cache. Only requested data is cached. Data can be stale until the TTL expires.

Write-through: the app writes to the database and the cache at the same time. Cached data is always fresh, but you may cache data nobody reads.

Many systems combine both, with a TTL on every key so stale data does not live forever.

Q31. How do you connect to RDS using IAM database authentication? Mid level

IAM auth lets apps connect with a short-lived token instead of a stored password. It works with MySQL, MariaDB and PostgreSQL.

  • Enable IAM authentication on the database.
  • Create a database user mapped to IAM, such as with GRANT rds_iam TO app_user; in PostgreSQL.
  • Give the app role rds-db:connect permission for that user.
aws rds generate-db-auth-token --hostname shopdb.abcdefghijkl.ap-south-1.rds.amazonaws.com --port 5432 --username app_user

The output is a token valid for 15 minutes. The app uses it as the password over a TLS connection.

Q32. What is the difference between Multi-AZ DB instance and Multi-AZ DB cluster deployments in RDS? Mid level

Multi-AZ DB instance: one primary and one standby in another AZ. The standby does not serve reads. Failover usually takes one to two minutes.

Multi-AZ DB cluster: one writer and two readable standby instances in three AZs, for MySQL and PostgreSQL. Failover is usually faster, and the standbys can serve read traffic.

Choose the cluster type if you need faster failover and some read scaling. It costs more because it runs three instances.

Q33. How does Aurora Global Database work? Mid level

Aurora Global Database spans multiple Regions. One primary Region handles writes. Up to several secondary Regions get read-only copies.

Replication uses storage-level replication with typical lag under one second.

In a Region outage, you can promote a secondary Region to be the new primary. For planned moves, a switchover keeps data consistent.

Use it for global low-latency reads and for disaster recovery with low RPO and RTO.

Q47. What are the RDS maintenance window and backup window? Mid level

The maintenance window is a weekly time slot, such as Sunday 02:00 to 02:30 UTC, when RDS may apply OS patches, required engine minor upgrades and pending changes you chose to apply later.

The backup window is a daily slot when automated backups start.

For Multi-AZ, many maintenance actions are done on the standby first, then RDS fails over, so downtime is short.

Choose low-traffic times in your users' time zone, and check pending maintenance with aws rds describe-pending-maintenance-actions.

Q48. Why do you need an index in DynamoDB if you can filter? Mid level

A filter expression is applied after DynamoDB reads the items. You still pay for every item read, and the query is still slow.

An index stores the data again with a different key, so the read touches only matching items.

Example: an Orders table keyed by CustomerId. The warehouse wants "all orders with status PENDING". Without an index, you Scan and filter the whole table. With a GSI keyed on Status, you Query only the pending orders.

Use sparse indexes too: only items that have the index key attribute appear in the index, which keeps it small.

4. Senior level and scenario questions

These questions check design thinking and troubleshooting. Think aloud. Say what you check first, what you change, and how you prevent it next time.

Q34. Your RDS database CPU is at 100 percent. How do you troubleshoot? Senior

Find the queries first, then fix the cause.

  • Open CloudWatch Database Insights or Performance Insights to see top SQL and wait events.
  • Check if a new release added a query without an index. Use EXPLAIN to check the plan.
  • Check connection count spikes. Many connections can cause high CPU.
  • Check for blocking locks or long transactions.

Short-term: kill a runaway query, scale up the instance class, or move reads to a replica.

Long-term: add the missing index, fix the query, add caching, and set up alarms on CPU and slow queries.

Q35. The application gets "too many connections" errors from RDS after moving to Lambda. What do you do? Senior

Each Lambda execution environment may open its own connection, so a traffic spike creates thousands of connections.

Fixes:

  • Put RDS Proxy between Lambda and the database to pool connections.
  • Open the connection outside the handler so it is reused across invocations.
  • Set reserved concurrency on the function to cap the maximum connections.
  • Check max_connections for the instance class, and tune it carefully.
  • Consider using the RDS Data API for Aurora, which avoids persistent connections.

Then load test to confirm.

Q36. DynamoDB requests are being throttled although total consumed capacity is below provisioned. Why? Senior

Total numbers can hide uneven use.

  • A hot partition key gets more traffic than one partition can handle.
  • A GSI is throttled. If a GSI does not have enough write capacity, writes to the base table are throttled too.
  • Traffic jumped faster than auto scaling could react. Auto scaling uses CloudWatch alarms and takes minutes.
  • In on-demand mode, sudden traffic far above the previous peak can be throttled until the table scales.

Use CloudWatch Contributor Insights for DynamoDB to see the most accessed keys, and fix the key design or pre-warm capacity.

Q37. How would you design the DynamoDB table for an e-commerce order system? Senior

Start from access patterns:

  • Get a customer's orders by date.
  • Get one order with its items.
  • Get orders by status for the warehouse.

Design:

  • PK = CUSTOMER#c-1001, SK = ORDER#2026-11-19#o-5001 for customer orders.
  • Order items as items with PK = ORDER#o-5001 and SK = ITEM#1, ITEM#2.
  • A GSI with Status as the partition key and OrderDate as the sort key for the warehouse. If one status is very hot, shard it.
  • Use TTL for abandoned carts and Streams to send events to other services.

Explain that you would validate the design with sample data and capacity estimates.

Q38. You must upgrade a production PostgreSQL RDS major version with minimal downtime. How? Senior

A plain in-place major upgrade needs downtime. Safer plan:

  • Test the upgrade on a restored snapshot. Check extensions and app compatibility.
  • Use RDS Blue/Green Deployments. RDS creates a green copy on the new version that stays in sync through logical replication.
  • Test the green environment.
  • Switch over. RDS renames endpoints so apps connect to green. Switchover usually takes about a minute.
  • Keep the blue environment for some time in case you need to roll back manually.

Take a manual snapshot before starting.

Q39. How do you choose between RDS and DynamoDB for a new service? Senior

Ask about the data and the access patterns.

Choose RDS or Aurora when:

  • You need complex joins, ad-hoc queries and reports.
  • Data is strongly relational with many constraints.
  • The team knows SQL well.

Choose DynamoDB when:

  • Access patterns are known and key-based.
  • You need very high scale with steady low latency.
  • You want serverless operations and pay-per-request pricing.

Many systems use both: DynamoDB for high-traffic lookups and a relational database or warehouse for reporting.

Q40. How would you set up disaster recovery for an Aurora MySQL database across Regions? Senior

Options from cheaper to faster recovery:

  • Backups copied to another Region with AWS Backup. RPO is hours and RTO is hours.
  • Cross-Region read replica. RPO is seconds to minutes. Promote it during disaster.
  • Aurora Global Database. Typical lag under one second and fast promotion.

Also prepare the rest: application stack in the DR Region with IaC, secrets replicated, Route 53 failover, and runbooks.

Test the failover at least twice a year and record the real RTO and RPO.

Q41. An RDS instance's storage is almost full. What do you do now and later? Senior

Now:

  • Turn on storage autoscaling, or increase the allocated storage. This happens online, though performance may be affected while it optimises.
  • Find what is growing: tables, indexes, or logs such as binary logs or WAL. A stuck replication slot in PostgreSQL can hold WAL files.

Later:

  • Set a CloudWatch alarm on FreeStorageSpace.
  • Archive old data, drop unused indexes, and clean up logs.
  • Remember that you cannot simply shrink allocated storage in place on a normal RDS instance. To get a smaller size, plan a migration to a new instance.
Q42. Your cache hit rate dropped after a deployment and the database is overloaded. What happened and how do you fix it? Senior

Common causes:

  • The deployment changed the cache key format, so all old keys miss.
  • A cache flush or new cluster started empty, causing a "cold cache".
  • TTLs became too short.

When many requests miss together for the same key, they all hit the database (a cache stampede).

Fixes:

  • Roll back the key change or warm the cache before switching traffic.
  • Use request coalescing or locks so only one request rebuilds a key.
  • Add jitter to TTLs so keys do not all expire at the same time.
  • Protect the database with connection limits and RDS Proxy.
Q43. How do you migrate a 2 TB on-premises Oracle database to Aurora PostgreSQL? Senior

Plan in phases.

  • Assess: use DMS Schema Conversion or the Schema Conversion Tool to convert schema and code, and see what needs manual work such as PL/SQL packages.
  • Convert and test the schema on Aurora PostgreSQL.
  • Migrate data with AWS DMS: full load, then CDC to keep it in sync.
  • Validate row counts and data with DMS validation.
  • Update the app's SQL and drivers, and run performance tests.
  • Cut over in a planned window: stop writes, let CDC catch up, switch the app.

Keep the source read-only for rollback for some time.

Q44. How do you make DynamoDB writes idempotent when a client retries? Senior

Retries can create duplicates if the first write succeeded but the response was lost.

  • Use a client-generated unique ID, such as an order ID, as the key, with attribute_not_exists(pk) as a condition. A retry fails the condition instead of creating a second item.
  • Or keep an idempotency record with the request ID and a TTL.
  • For transactions, TransactWriteItems supports a ClientRequestToken that makes the call idempotent for a short window.

Explain that idempotency is needed in any system with retries, not only DynamoDB.

Q45. How do you control DynamoDB cost for a large table? Senior

Look at both capacity and storage.

  • Pick the right mode. Steady high traffic is often cheaper on provisioned with auto scaling and reserved capacity.
  • Avoid Scans. Use Query with good keys and sparse indexes.
  • Project only needed attributes into GSIs, because each GSI stores and writes its own copy.
  • Use TTL to delete old data, and the Standard-IA table class for large tables that are rarely read.
  • Use eventually consistent reads where possible, which cost half.
  • Watch Cost Explorer by table tags.
Q46. Users in Europe and Asia need low-latency writes to the same DynamoDB data. What do you suggest? Senior

Use DynamoDB global tables. Each Region gets a replica table that accepts reads and writes.

By default, replication is asynchronous and conflicts are resolved with "last writer wins". Design for this, for example by routing a user's writes to their home Region.

DynamoDB also offers a multi-Region strong consistency option for global tables, with its own rules and trade-offs, such as higher write latency. Check current documentation for supported Regions and limits.

Explain the trade-off between latency, consistency and cost.

Q49. Read replica lag on RDS MySQL keeps growing. How do you troubleshoot it? Senior

Check the ReplicaLag metric and find the cause.

  • The replica is smaller than the primary or has slower storage. Match or increase its size and IOPS.
  • Heavy write bursts or big single transactions on the primary, such as a large DELETE. Break them into small batches.
  • Long-running read queries on the replica block replication. Kill or move them.
  • Tables without primary keys make row-based replication slow. Add primary keys.

Tell the app not to read its own recent writes from the replica, or route those reads to the primary.

Q50. How would you store user sessions for a web app that runs on 20 servers? Senior

Do not keep sessions in server memory, because users would lose them when a server is replaced, and you would need sticky sessions.

Options:

  • ElastiCache (Valkey or Redis OSS) with replication and Multi-AZ: very fast, with TTL for session expiry.
  • DynamoDB with TTL: serverless, durable, and simple to scale. Good when you want no cache cluster to manage.

Encrypt session data in transit and at rest, keep it small, and set expiry. Then the web tier becomes stateless and can scale freely.

5. Frequently asked questions

Should a fresher learn DynamoDB data modelling deeply?

Learn the basics: partition key, sort key, Query vs Scan, GSI and capacity modes. Deep single-table design is usually asked in mid and senior interviews.

Is Aurora always better than RDS?

No. Aurora gives faster failover, more replicas and shared storage, but it can cost more for small or steady workloads. Choose by need.

Which database topic causes most production incidents?

Connection limits, slow queries, storage full, and hot partitions in DynamoDB. Practise these scenarios.

6. Quick revision

  • Multi-AZ is for availability. Read replicas are for read scaling.
  • Automated backups give point-in-time restore for up to 35 days.
  • 1 RCU = one strongly consistent read per second of up to 4 KB. 1 WCU = one write per second of up to 1 KB.
  • Query uses keys and is efficient. Scan reads the whole table.
  • Cache with lazy loading and a TTL, and plan for cache misses.

This page is one part of a 500-question AWS interview set. Open the full list here: All 500 AWS interview questions.