Autocoder

AWS Interview Questions and Answers

Last updated 2026-11-19

AWS interviews reward people who can explain trade-offs, not list services. Why would you put an application in private subnets? When is S3 enough and when do you need EFS? How does IAM decide between an allow and a deny? This page covers 16 questions on the core services that appear in almost every cloud, DevOps and backend interview, with CLI commands and policy JSON you can adapt.

Answers assume you know the basics of networking; if not, read the network security questions first. For the surrounding role and process, see how to crack a DevOps interview. Service limits and prices change, so check the AWS documentation for current figures rather than quoting numbers from memory.

Core servicesEC2, S3, VPC, IAM, RDS, Lambda, ELB, Auto Scaling, CloudWatch
Frequent themesHigh availability across AZs, least-privilege IAM, cost optimisation, shared responsibility
Useful certification trackCloud Practitioner, then Solutions Architect Associate or Developer Associate

The mental model that answers most questions

Think in layers: identity (IAM), network (VPC, security groups), compute (EC2, containers, Lambda), data (S3, RDS, DynamoDB) and operations (CloudWatch, CloudTrail). For any design question, state how it survives the loss of one Availability Zone, who can access it and how, how it scales and what it costs. Interviewers often follow every answer with one of those four questions.

AWS Interview Questions and Answers: questions with worked answers

  1. 1

    What are Regions, Availability Zones and edge locations?

    easy

    A Region is a separate geographic area such as ap-south-1 (Mumbai), made of multiple isolated Availability Zones. An AZ is one or more data centres with independent power, cooling and networking, connected to its siblings by low-latency links. Deploying across at least two AZs protects against a data-centre failure; deploying across Regions protects against a regional outage and serves data-residency needs. Edge locations are CloudFront and other content-delivery points of presence that cache content close to users. Most services are Regional, resources are not shared across Regions by default, and a few such as IAM and Route 53 are global.

  2. 2

    Explain the shared responsibility model.

    easy

    AWS is responsible for security of the cloud: physical facilities, hardware, the hypervisor and the managed-service software. The customer is responsible for security in the cloud: IAM configuration, data classification and encryption choices, network rules, operating system patching on EC2, and application security. The line moves with the service. For EC2 you patch the guest OS; for RDS AWS patches the database engine but you manage users, parameters and network exposure; for S3 you decide bucket policy and public access settings.

  3. 3

    How does IAM evaluate permissions? Write a least-privilege policy for one S3 bucket.

    medium

    Requests are denied by default. An explicit Deny anywhere always wins; otherwise a request is allowed only if an applicable policy allows it and no boundary stops it. Service control policies, permission boundaries and session policies can only restrict, never grant. Prefer roles with temporary credentials over IAM users with long-lived keys, grant specific actions on specific resources, and add conditions where possible. The policy below lets a service list one bucket and read and write objects under one prefix only.

    json
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": "s3:ListBucket",
          "Resource": "arn:aws:s3:::acme-reports",
          "Condition": { "StringLike": { "s3:prefix": ["daily/*"] } }
        },
        {
          "Effect": "Allow",
          "Action": ["s3:GetObject", "s3:PutObject"],
          "Resource": "arn:aws:s3:::acme-reports/daily/*"
        }
      ]
    }
  4. 4

    What is the difference between an IAM role and an IAM user, and how does an EC2 instance get AWS permissions?

    medium

    A user is a long-lived identity with a password or access keys. A role has no permanent credentials; a trusted principal assumes it through AWS STS and receives temporary credentials. An EC2 instance gets permissions through an instance profile that wraps a role, and the SDK reads temporary credentials from the instance metadata service, rotating them automatically. This avoids storing access keys on disk. Require IMDSv2, which uses session tokens, to reduce the impact of server-side request forgery attacks that try to steal the credentials.

    bash
    aws sts get-caller-identity
    aws ec2 modify-instance-metadata-options --instance-id i-0abc123 --http-tokens required --http-endpoint enabled
  5. 5

    Explain a VPC: subnets, route tables, internet gateway, NAT gateway, security groups and NACLs.

    medium

    A VPC is your private network in a Region with a CIDR range. A subnet is a slice of that range in one AZ. A subnet is public if its route table sends 0.0.0.0/0 to an internet gateway and its resources have public IPs; private subnets have no such route. A NAT gateway sits in a public subnet and lets private instances initiate outbound connections without being reachable inbound. Security groups are stateful and attach to network interfaces, with allow rules only. Network ACLs are stateless, attach to subnets and have numbered allow and deny rules evaluated in order, so you must permit return traffic including ephemeral ports. A standard design puts load balancers in public subnets and application and database tiers in private ones.

  6. 6

    S3 storage classes and consistency: how do you choose, and what guarantees does S3 give?

    medium

    S3 provides strong read-after-write consistency for objects and list operations. Standard suits frequently accessed data. Standard-IA and One Zone-IA cost less per GB but charge retrieval fees and have minimum storage durations; One Zone keeps data in a single AZ. Intelligent-Tiering moves objects between tiers automatically when access patterns are unknown. Glacier Instant Retrieval, Flexible Retrieval and Deep Archive trade retrieval speed for very low storage cost. Lifecycle rules automate transitions and expiry. Enable versioning for recovery from accidental deletes, and use Block Public Access plus default encryption (SSE-S3 is on by default, SSE-KMS adds key control and audit).

    bash
    aws s3api put-bucket-versioning --bucket acme-reports --versioning-configuration Status=Enabled
    aws s3api put-public-access-block --bucket acme-reports --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
  7. 7

    EBS, EFS and S3: what is each for?

    easy

    EBS is block storage attached to one EC2 instance in one AZ, behaving like a disk; it suits boot volumes and databases, and you back it up with snapshots stored in S3. EFS is a managed NFS file system that many instances across AZs mount at once, good for shared content and home directories. S3 is object storage accessed through an API over HTTP, nearly unlimited and cheap, best for backups, static assets, logs and data lakes, not for POSIX file semantics or low-latency random writes. Instance store is ephemeral disk physically attached to the host and lost when the instance stops or fails.

  8. 8

    How do you make a web application highly available on AWS?

    medium

    Run instances in an Auto Scaling group spread across at least two AZs behind an Application Load Balancer whose health checks remove unhealthy targets. Keep the instances stateless: sessions in ElastiCache or DynamoDB, uploads in S3. Use RDS Multi-AZ, which keeps a synchronous standby in another AZ and fails over automatically, and add read replicas if reads need scaling. Put CloudFront in front for caching and Route 53 health checks for DNS failover. For disaster recovery across Regions pick a strategy by recovery objectives: backup and restore, pilot light, warm standby or active-active, each costing more but recovering faster.

  9. 9

    Compare Application Load Balancer, Network Load Balancer and Gateway Load Balancer.

    medium

    The ALB works at layer 7: routing by host, path, header or query string, HTTP/2 and WebSockets, authentication integration and targets that include instances, IPs and Lambda. The NLB works at layer 4 with very high throughput and low latency, preserves the client source IP, supports static or Elastic IPs per AZ and handles TCP, UDP and TLS. The Gateway Load Balancer transparently inserts third-party virtual appliances such as firewalls using GENEVE encapsulation. Choose ALB for typical web and microservice routing, NLB for non-HTTP protocols or extreme performance, GWLB for traffic inspection.

  10. 10

    When would you use Lambda instead of EC2, and what are Lambda's limits and gotchas?

    medium

    Lambda suits event-driven, spiky or short-lived work: S3 triggers, API Gateway backends, queue consumers, scheduled jobs. You pay per request and duration, with no servers to patch. Gotchas: a maximum execution time of 15 minutes, cold starts that add latency after idle periods (mitigated with provisioned concurrency or SnapStart for Java), concurrency limits that can overwhelm a downstream database unless you set reserved concurrency or use RDS Proxy, and statelessness, so keep state outside. For steady, high-volume, long-running or specialised workloads, containers or EC2 can be cheaper and more controllable.

    python
    import json
    
    def handler(event, context):
        # S3 put event: log each new object key
        for rec in event.get("Records", []):
            key = rec["s3"]["object"]["key"]
            print(json.dumps({"new_object": key}))
        return {"statusCode": 200}
  11. 11

    Describe how SQS, SNS and EventBridge differ.

    medium

    SQS is a pull-based queue: producers send messages, consumers poll and delete them after processing, which decouples and buffers load; standard queues give at-least-once delivery with best-effort ordering, and FIFO queues give ordering and deduplication. SNS is push-based pub/sub that fans a message out to many subscribers such as SQS queues, Lambda and HTTP endpoints. EventBridge is an event bus with content-based rules that route events from AWS services, SaaS partners and your own apps to targets, with schemas and scheduling. A common pattern is SNS or EventBridge fan-out into per-consumer SQS queues with dead-letter queues for poison messages.

  12. 12

    RDS versus DynamoDB: how do you choose?

    medium

    RDS (and Aurora) provides managed relational engines with SQL, joins, transactions and a fixed schema, scaling vertically and through read replicas; choose it for relational data and complex queries. DynamoDB is a managed key-value and document store with single-digit-millisecond access at any scale, partitioned by key, billed per request or provisioned capacity. Its access patterns must be designed up front around partition and sort keys, and ad-hoc joins are not supported. Pick DynamoDB for known access patterns, huge scale and serverless architectures, and RDS when requirements are still shifting or analytic SQL matters.

  13. 13

    How do you reduce an AWS bill?

    medium

    Measure with Cost Explorer and cost allocation tags, then act on the largest lines. Right-size over-provisioned instances using CloudWatch and Compute Optimizer. Commit with Savings Plans or Reserved Instances for steady usage, and use Spot Instances for fault-tolerant work such as batch and CI at large discounts, accepting two-minute interruption notices. Shut down non-production environments out of hours, delete unattached EBS volumes and old snapshots, move cold S3 data to cheaper classes with lifecycle rules, and reduce data transfer by using VPC endpoints and CloudFront. Set AWS Budgets alerts so surprises are caught early.

  14. 14

    What is the difference between CloudWatch and CloudTrail?

    easy

    CloudWatch is about operational telemetry: metrics, logs, alarms, dashboards and events about how resources are performing. CloudTrail records API calls made in your account, showing who did what, from where and when, which is essential for security investigation and compliance. A mnemonic is that CloudWatch tells you how the system is behaving and CloudTrail tells you who changed it. Enable an organisation trail to a protected S3 bucket with log file validation, and send critical findings to alarms.

  15. 15

    How can two VPCs communicate, and what are the limits of VPC peering?

    hard

    VPC peering creates a private, non-transitive connection between two VPCs; CIDR ranges must not overlap, and you must add routes and security group rules on both sides. Non-transitive means if A peers with B and B peers with C, A cannot reach C through B. For many VPCs or on-premises networks, use Transit Gateway as a hub, which supports transitive routing and attachments for VPNs and Direct Connect. PrivateLink exposes a single service to consumers through an endpoint without opening whole-network routing, which is safer when you only need one service.

  16. 16

    How do you secure data in AWS at rest and in transit?

    medium

    At rest, enable encryption with KMS keys for EBS, RDS, S3 and DynamoDB, using customer-managed keys when you need key policies, rotation control and audit through CloudTrail. In transit, require TLS: ACM issues and renews certificates for load balancers and CloudFront, and S3 bucket policies can deny requests where aws:SecureTransport is false. Keep traffic inside AWS with VPC endpoints for S3 and DynamoDB, store credentials in Secrets Manager with rotation, and use Security Hub, GuardDuty and Macie to detect misconfiguration and sensitive data exposure.

  17. 17

    Write CLI commands to launch an instance, then find and stop all instances with a given tag.

    medium

    run-instances needs an AMI, instance type and ideally a subnet, security group and IAM instance profile. Tag at creation so cost and automation can find it. describe-instances with a tag filter and a JMESPath query returns IDs, which you pass to stop-instances. Stopping preserves EBS volumes and stops compute charges, whereas terminating deletes the instance. Always dry-run destructive commands against a filter first.

    bash
    aws ec2 run-instances --image-id ami-0abcdef1234567890 --instance-type t3.micro \
      --subnet-id subnet-0123abcd --security-group-ids sg-0123abcd \
      --tag-specifications 'ResourceType=instance,Tags=[{Key=Env,Value=dev}]'
    
    IDS=$(aws ec2 describe-instances \
      --filters Name=tag:Env,Values=dev Name=instance-state-name,Values=running \
      --query 'Reservations[].Instances[].InstanceId' --output text)
    aws ec2 stop-instances --instance-ids $IDS

Frequently asked questions

Which AWS certification is best for a fresher?

Cloud Practitioner gives vocabulary and is quick, but Solutions Architect Associate is the one most hiring managers recognise, because it covers networking, storage, security and high availability design in depth.

Can I practise AWS without paying?

AWS offers a Free Tier for new accounts with limited usage, and terms change, so read the current Free Tier page. Always set a budget alert, and delete resources such as NAT gateways and load balancers after practising, because they bill by the hour.

What is the difference between a security group and a NACL?

Security groups are stateful, instance-level and allow-only. NACLs are stateless, subnet-level and support explicit deny, so return traffic must be allowed separately.

How much CLI knowledge is expected?

Enough to inspect and change resources without the console: configure profiles, query with --query and filters, and understand IAM errors. Infrastructure should usually be created with Terraform or CloudFormation, not hand-run commands.

Related guides

More in Role-wise Interview Questions by Job and Tech Stack

See all in this section