Skip to content
Tutorials Center
My learning

Topics

Lesson 68 of 70 ยท Practice, interviews and cheat sheet

AWS Interview Questions

Prepare for AWS interviews with questions and clear answers on IAM, networking, storage, compute, serverless and architecture scenarios, plus runnable practice tools.

An AWS interview rarely checks whether you memorized a service list. Interviewers want to hear how you reason: which service you would pick, what you would check first when something breaks, and which trade-off you accepted. This lesson collects the questions that come up again and again, with answers short enough to say out loud.

Use it actively. Cover the answer, say yours, then compare. Where a question has a "why", that is the part that earns the points. Everything on AWS itself is read-only here, but two small tools at the end let you rehearse the arithmetic and the service-picking that interviewers love.

Answer in three beats: the direct answer, the reason, and the trade-off or exception. "Use an SQS queue between them, because it buffers spikes and lets the consumer fail independently; the cost is that the result is no longer immediate."

IAM and security questions

What is the difference between an IAM user and an IAM role? A user is a long-lived identity with its own credentials. A role has no credentials of its own: a trusted principal assumes it and receives temporary credentials from STS. Prefer roles for applications, instances, Lambda functions and cross-account access, because nothing permanent can leak. See IAM Users, Groups and Roles.

How does AWS decide whether a request is allowed? Everything starts as an implicit deny. Any explicit deny in any applicable policy wins immediately. Otherwise the request needs an allow, and that allow must also pass every guardrail that applies: service control policies, permission boundaries and session policies. Within a single account, an identity policy or a resource policy can grant access; across accounts, both sides must allow it. Details in How Policy Evaluation Works.

A developer gets AccessDenied on an S3 object they can list. What do you check? Listing needs s3:ListBucket on the bucket ARN, while reading needs s3:GetObject on the object ARN. Then look for an explicit deny, a bucket policy condition (VPC endpoint, IP, MFA), SSE-KMS permissions on the key, a permission boundary and an SCP. Object ownership matters if the object was written by another account.

What is least privilege and how do you get there in practice? Grant only the actions on the resources a workload needs. Start from a broad policy in a test account, read the CloudTrail history or use IAM Access Analyzer to generate a policy from real activity, then tighten it. Review unused permissions regularly with last-accessed data.

Why should you not use the root user? It cannot be restricted by IAM policies and it can do things nobody else can, such as closing the account. Protect it with MFA, give it no access keys, and use it only for the few tasks that require it.

How do you protect secrets? Never put them in code, AMIs or environment files in Git. Use Secrets Manager for credentials that rotate and Parameter Store for configuration. The workload reads them through its role at runtime, and KMS encrypts them at rest.

Networking questions

What makes a subnet public? Its route table has a route to an internet gateway, and the instance has a public or Elastic IP. A private subnet has no such route; it reaches the internet, if at all, through a NAT gateway in a public subnet. See VPC Fundamentals.

Security group or network ACL: what is the difference? Security groups attach to network interfaces, are stateful, and have only allow rules. Network ACLs attach to subnets, are stateless, support allow and deny, and are evaluated in rule-number order. Because NACLs are stateless you must also allow the return traffic on ephemeral ports. See NACLs, Flow Logs and Network Security.

An instance in a private subnet cannot reach the internet. Why? Work through the path: does the private route table send 0.0.0.0/0 to a NAT gateway; does that NAT gateway sit in a public subnet whose route table points to an internet gateway; does the security group allow outbound traffic; does a NACL block it. Also check DNS resolution.

How do you connect two VPCs? For a few VPCs, peering is simple and cheap, but it is not transitive and the CIDR blocks must not overlap. For many VPCs or on-premises links, use a Transit Gateway as a hub. For exposing one service privately to many consumers, use PrivateLink. See Peering, Transit Gateway, VPN and Direct Connect.

How do you keep S3 or DynamoDB traffic off the internet? Use gateway endpoints for S3 and DynamoDB (free, route-table based) or interface endpoints for most other services (they cost per hour and per GB). See NAT Gateways and VPC Endpoints.

Storage and database questions

Which S3 storage class would you choose for data with unknown access patterns? Intelligent-Tiering, because it moves objects between access tiers automatically for a small monitoring fee. For known cold data, lifecycle rules to Standard-IA, then Glacier classes. Remember minimum storage durations and retrieval fees. See Storage Classes and Lifecycle Rules.

How do you make an S3 bucket secure? Keep Block Public Access on, use bucket policies with least privilege, require TLS, enable default encryption, turn on versioning for important data, log access, and serve public content through CloudFront with Origin Access Control instead of making the bucket public.

RDS Multi-AZ or read replica? Multi-AZ is for availability: a standby in another AZ takes over on failure, and you cannot read from it in the classic single-standby setup. Read replicas are for read scaling and use asynchronous replication, so they can lag. They solve different problems and are often combined.

When would you choose DynamoDB over RDS? When access patterns are known and key-based, you need single-digit-millisecond latency at any scale, and you want no servers to manage. Choose RDS when you need joins, ad hoc queries, transactions across many tables, or an existing relational schema. See DynamoDB Fundamentals.

What is a hot partition? A partition key that receives a disproportionate share of traffic, so one partition throttles while the table's total capacity looks fine. Fix it with a higher-cardinality key, write sharding, or caching.

EBS or instance store? EBS volumes persist independently of the instance, support snapshots, and can be detached. Instance store is physically attached, very fast, and lost when the instance stops or fails. Use it for caches and scratch data only.

Compute and serverless questions

Compare On-Demand, Reserved/Savings Plans and Spot. On-Demand has no commitment. Savings Plans and Reserved Instances trade a one- or three-year commitment for a discount, ideal for steady baselines. Spot is the deepest discount, but AWS can reclaim capacity with a two-minute warning, so use it for fault-tolerant work. See On-Demand, Reserved, Savings Plans and Spot.

What is a cold start and how do you reduce it? The extra latency when Lambda must create a new execution environment and initialize your code. Reduce package size and initialization work, keep heavy clients outside the handler, add memory (which also adds CPU), use provisioned concurrency for latency-critical paths, or choose a lighter runtime. See Lambda Concurrency, Cold Starts and Limits.

A Lambda function times out when calling an external API. What do you check? Whether the function is in a VPC without a NAT gateway or endpoint, the timeout compared with the downstream latency, the memory setting, and retries stacking up. Add timeouts to your own HTTP calls so the function fails fast with a useful error.

SQS or SNS? SQS is a pull-based queue: one consumer group processes each message, and it buffers work. SNS is push-based pub/sub: it delivers a copy to every subscriber. They are combined in fan-out: an SNS topic delivering to several SQS queues. See SQS, SNS and Fan-Out.

How do you handle a message that always fails? Set a maximum receive count and a dead-letter queue. After that many failed attempts the message moves aside for inspection instead of blocking the queue. Make the consumer idempotent, since standard queues deliver at least once.

ECS Fargate or EC2 launch type? Fargate removes server management and bills per task resources; it suits most teams. EC2 launch type gives control over instance types, GPUs, daemon tasks and, at high steady utilization, lower cost.

Architecture scenario questions

Design a highly available web application. Put an Application Load Balancer across at least two AZs, run instances or tasks in an Auto Scaling group or service in private subnets, use a Multi-AZ database, store static assets in S3 behind CloudFront, and add health checks, alarms and automated recovery. Mention the trade-offs: cost doubles with a second AZ, and a single region still has regional risk.

How would you design for disaster recovery? Start from the business targets: RTO (how long to recover) and RPO (how much data you can lose). Backup and restore is cheapest and slowest; pilot light keeps core data replicated and compute off; warm standby runs a scaled-down copy; active-active has the shortest recovery and the highest cost. See High Availability and Disaster Recovery.

Your AWS bill doubled this month. What do you do? Open Cost Explorer grouped by service, then by usage type and tag. Look for NAT gateway data processing, data transfer, idle load balancers and instances, unattached volumes, and runaway logging. Fix the cause, then add budgets and anomaly detection. See Cost Management and Optimization.

How do you deploy without downtime? Rolling updates behind a load balancer, blue/green with a traffic switch, or canary releases with automatic rollback on alarms. Database changes must be backward compatible so old and new versions can run side by side.

Image uploads must be processed asynchronously. What do you build? Upload to S3, let the S3 event go to an SQS queue, process with Lambda or a Fargate worker, store metadata in DynamoDB, and attach a dead-letter queue. The queue absorbs bursts and isolates failures. See Project: Event-Driven Image Pipeline.

flowchart LR
    U["Client"] --> S3["S3 upload"]
    S3 --> Q["SQS queue"]
    Q --> L["Lambda worker"]
    L --> D["DynamoDB metadata"]
    Q -. "after N failures" .-> DLQ["Dead-letter queue"]

A classic scenario answer: buffer with a queue, process independently, and keep failures visible.

Scenario questions, part 2: troubleshooting and design under pressure

These questions give a symptom or a constraint and ask what you would do. A strong answer states a method (what you check first and why) before naming services.

Users get 502 Bad Gateway from your Application Load Balancer. How do you investigate? A 502 means the load balancer reached a target but got a bad or closed response. (A 503 means no healthy targets, a 504 means the target timed out.) Start with the target group health and the CloudWatch metrics HTTPCode_ELB_502_Count and HTTPCode_Target_5XX_Count to separate "the app returned an error" from "the load balancer could not talk to the app". Check the application logs for crashes and restarts, and the ALB access logs for the error_reason field. A classic cause is the keep-alive mismatch: the ALB idle timeout is 60 seconds, and if the application closes idle connections sooner, the ALB reuses a connection that the app already closed. Set the app's keep-alive timeout higher than the ALB idle timeout. Also look at oversized headers or responses and at a target that starts but is not ready. See Elastic Load Balancing.

Your Auto Scaling group is not launching instances. What do you check? Read the group's activity history, which states the reason for each failed launch. Usual causes: the account has reached an instance or vCPU quota; the instance type has no capacity in the chosen zone (add more types and zones); the launch template is broken (the AMI was deleted or is not shared, the security group belongs to another VPC, the instance profile cannot be passed); an encrypted EBS volume uses a KMS key whose policy does not allow the Auto Scaling service-linked role; the subnet has no free IP addresses; or a Spot request cannot be filled. Fix the cause, then check that the scaling policy and the desired capacity actually ask for more instances. See Auto Scaling Groups.

A Lambda function in a VPC times out when it connects to RDS. Why? Check the network path in order: the function's subnets and the database are in the same VPC (or connected), the database security group allows the function's security group on the database port, and route tables and network ACLs allow the traffic. If the function also calls the internet or an AWS API, a function in a private subnet needs a NAT gateway or a VPC endpoint, or that call hangs until the timeout. If connections work but fail under load, the cause is connection exhaustion: each concurrent invocation opens its own connection. Put RDS Proxy in between, reuse connections outside the handler, and cap concurrency. Make sure the Lambda timeout is longer than the database connection timeout so errors are readable. See Lambda Scaling and Cold Starts and RDS and Aurora.

An access key was leaked on GitHub. What do you do? Act in this order. (1) Deactivate the key right away (deactivating is reversible and keeps the key's history visible, while deleting is not). (2) Use CloudTrail to list everything the key did, in every Region, since it was created: look for new users, roles, access keys, instances (crypto mining) and changed policies. (3) Revoke any temporary sessions the key may have created, for example by attaching a deny policy for tokens issued before now. (4) Delete what the attacker created, rotate other credentials that may have been exposed, and contact AWS Support if you see abuse. (5) Remove the secret from the repository history (rewrite history and treat it as compromised anyway). (6) Prevent a repeat: use roles and temporary credentials instead of long-lived keys, secret scanning in CI, and GuardDuty alerts. See IAM Best Practices and CloudTrail, Config and X-Ray.

How would you migrate a 10 TB on-premises Oracle database to AWS with minimal downtime? Decide the target first: RDS for Oracle (same engine, least change) or Aurora PostgreSQL (cheaper licensing, needs code changes). For a different engine, run the AWS Schema Conversion Tool to convert schema and code and list manual work. Use DMS for a full load followed by change data capture (CDC), so the source stays live while the target catches up. Get the data there with Direct Connect or VPN if the bandwidth allows (10 TB takes days on a modest link), or seed with a Snow device. Rehearse in a test migration, validate row counts and checksums with DMS validation, and plan the cutover: stop writes, let CDC drain, switch the application, and keep a rollback path. See Migration and Hybrid Cloud.

How would you apply zero-trust principles to an EKS cluster? Trust nothing by network position: authenticate and authorize every call. Use a private API endpoint and IAM-based access entries with least privilege. Give each workload its own IAM role with IRSA or Pod Identity instead of the node role. Restrict pod traffic with network policies and security groups for pods, and add mutual TLS (a service mesh) between services. Keep secrets in Secrets Manager, with envelope encryption of Kubernetes secrets using KMS. Enforce Pod Security standards, scan and sign images in ECR, run as non-root with read-only file systems, turn on audit logs and GuardDuty for EKS, and log everything to CloudWatch. See Amazon EKS in Depth.

A user gets "Access Denied" on an S3 object that they should be able to read. How do you debug it? Work through the evaluation layers, because an explicit deny anywhere wins (see IAM Policy Evaluation Logic). Check, in order: the user's identity policy allows s3:GetObject on the object ARN (and s3:ListBucket on the bucket, or a missing key may show as 403 instead of 404); the bucket policy has no deny (for example aws:SecureTransport, source IP or VPC conditions); S3 Block Public Access and any access point policy; a permission boundary or an SCP from the Organization; a VPC endpoint policy if the request comes through an endpoint. For SSE-KMS objects the caller also needs kms:Decrypt on the key. For cross-account access, both accounts must allow it, and the object owner matters if the uploader was another account. CloudTrail data events and the IAM policy simulator show the reason. See S3 Security.

The stand-in below turns the S3 answer into a checklist engine. You describe what is true, and it reports the first layer that explains the denial. It is a teaching aid with simplified rules, not the real evaluation engine.

Python Why is S3 saying Access Denied?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Practice tools

Interviewers often ask for quick arithmetic. Composite availability is a favorite: services in a chain multiply, redundant copies improve the odds.

Python Availability maths

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The numbers are illustrative inputs, not AWS SLAs. The point to say aloud: adding a second app server helps, but the load balancer and database are now the weakest links, so they need redundancy too.

The second tool is a toy service picker. It is a stand-in for the habit of turning keywords in a requirement into a first guess, which you then challenge.

Python Requirement to first-guess service

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A real answer always adds the follow-up question: expected traffic, latency target, consistency needs, budget and team skills.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. A request is allowed by an identity policy but matches an explicit Deny in an SCP. What happens?

    An explicit deny in any applicable policy, including a service control policy, overrides every allow.
  2. 2. Which statement best separates a security group from a network ACL?

    Security groups track connections, so return traffic is automatic, and they only allow. NACLs are stateless, support deny, and apply per subnet in rule-number order.
  3. 3. What is the best answer to: how do you stop one failing message from blocking an SQS queue?

    After the configured number of failed receives, the message moves to the dead-letter queue, where you can inspect it, while the main queue keeps flowing.
  4. 4. Which workload is the best fit for Spot Instances?

    Spot capacity can be reclaimed with short notice, so it suits interruptible, restartable work such as batch processing or stateless workers.
  5. 5. Two services in a chain each have 99.9% availability. Roughly what is the combined availability?

    Serial dependencies multiply, so 0.999 x 0.999 is about 0.998, which is 99.8%.

Summary

  • Answer with the direct answer, the reason and the trade-off.
  • For access problems, think in layers: explicit deny, allow, guardrails (SCP, boundary), resource policy, then KMS and conditions.
  • For network problems, trace the path: route table, gateway, security group, NACL, DNS.
  • Choose storage by access pattern, databases by query needs, and compute by how much you want to manage.
  • Architecture answers should cover availability, scaling, failure isolation and cost.
  • Do the arithmetic yourself: chains multiply availability, redundancy improves it.

Next: AWS Cheat Sheet