Ravindra BagaleCourses & study guides Track your progress

AWS Cloud

AWS VPC and Networking Interview Questions and Answers (50 Questions with Scenarios)

This page has 50 new AWS VPC and networking interview questions with full answers. Networking is where many candidates lose marks, because the answers need clear thinking about routes, firewalls and DNS. The answers connect each concept to a practical networking situation, using simple English.

1. An everyday example: a gated housing society

Every real AWS project runs inside a VPC. If you cannot explain how a packet moves from the internet to a private database, the interviewer will doubt that you can fix a production outage.

Think of a gated housing society. The VPC is the whole society with its own address range. Subnets are the separate buildings. The route table is the signboard at each gate that says which road goes where. The internet gateway is the main gate to the city road. The NAT gateway is a helper at the gate who goes out to buy things for residents but never lets strangers walk in. Security groups are the locks on each flat door. Network ACLs are the guards at each building entrance.

How to use this page

  • Draw the network on paper while you answer. Interviewers love a quick diagram.
  • For every scenario, follow the packet: source, route, firewall, destination, and the return path.
  • Practise the read-only CLI commands in a practice account.

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 a VPC in AWS? Fresher

A VPC (Virtual Private Cloud) is your own private, isolated network inside an AWS Region.

You choose its IP range, for example 10.0.0.0/16. Then you create subnets, route tables, gateways and firewalls inside it.

Everyday example: AWS is a big city, and your VPC is your own gated society inside it. Nobody can walk in unless you open a gate.

A VPC spans all Availability Zones of a Region, but each subnet lives in exactly one AZ.

Q2. What is the allowed CIDR size for a VPC and a subnet? Fresher

For IPv4, a VPC CIDR block can be from /16 (65,536 addresses) down to /28 (16 addresses). The same size range applies to subnets.

Use private ranges from RFC 1918, such as 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16.

Tip: choose a range that does not overlap with your office network or other VPCs. Overlapping ranges block VPC peering and make VPN routing hard later.

You can add more CIDR blocks to a VPC later if you run out of space.

Q3. How many IP addresses does AWS reserve in each subnet? Fresher

AWS reserves 5 IP addresses in every subnet. For the subnet 10.0.1.0/24 they are:

  • 10.0.1.0: the network address.
  • 10.0.1.1: the VPC router.
  • 10.0.1.2: reserved for the Amazon DNS server.
  • 10.0.1.3: reserved for future use.
  • 10.0.1.255: the last address, the broadcast address. AWS does not support broadcast, but it still reserves it.

So a /24 subnet gives 256 minus 5, which is 251 usable addresses.

Q4. Which setting really decides whether an AWS subnet is public or private? Fresher

The difference is only the route table.

A public subnet has a route table with 0.0.0.0/0 pointing to an internet gateway (igw-...).

A private subnet has no route to an internet gateway. It may have 0.0.0.0/0 pointing to a NAT gateway for outbound-only internet access.

Note: an instance in a public subnet also needs a public IPv4 address or an Elastic IP to talk to the internet.

Q5. What is an internet gateway? Fresher

An internet gateway (IGW) connects a VPC to the internet. It is highly available and AWS scales it for you.

It does two jobs. It is the route target for internet traffic, and it does one-to-one address translation between an instance's private IP and its public IP.

You can attach only one internet gateway to a VPC at a time. Without it, nothing in the VPC can reach the internet directly.

Q6. What is a route table and what is the local route? Fresher

A route table is a list of rules that says where network traffic should go. Each rule has a destination CIDR and a target.

Every route table has a local route for the VPC CIDR, for example 10.0.0.0/16 → local. It lets all subnets in the VPC talk to each other. You cannot delete it.

Each subnet is linked to exactly one route table. If you do not link one, the subnet uses the VPC's main route table.

Q7. What is a security group? Fresher

A security group is a virtual firewall for resources such as EC2 instances, load balancers and RDS databases. It works at the network interface level.

Facts to say in an interview:

  • It has only allow rules. Anything not allowed is blocked.
  • It is stateful. If inbound traffic is allowed, the reply is allowed out automatically.
  • By default, a new group allows all outbound traffic and no inbound traffic.
  • A rule can use another security group as the source, for example "allow 3306 from the app-tier security group".
Q8. What is a network ACL? Fresher

A network ACL (NACL) is a firewall at the subnet level.

  • It has numbered rules that are checked from the lowest number up. The first match wins.
  • It supports both allow and deny rules.
  • It is stateless. Return traffic must be allowed separately, usually on ephemeral ports 1024 to 65535.
  • The default NACL allows all inbound and outbound traffic. A new custom NACL denies everything until you add rules.

Use NACLs for broad blocks, such as denying a bad IP range for a whole subnet.

Q9. What is an Elastic IP address? Fresher

An Elastic IP is a static public IPv4 address that you keep in your account until you release it.

You can move it from one instance to another, for example during a failover, and the public address stays the same.

Note on cost: AWS charges for all public IPv4 addresses, including Elastic IPs, whether they are attached or not. So release Elastic IPs you do not use.

Q10. What is a NAT gateway and why is it used? Fresher

A NAT gateway lets instances in private subnets start connections to the internet, for example to download updates. It does not allow the internet to start connections to them.

Everyday example: a society helper who goes out to buy groceries for residents, but strangers cannot use him to enter the flats.

For a public NAT gateway, you place it in a public subnet with an Elastic IP. Then the private route table gets 0.0.0.0/0 → nat-....

It is a managed service with an hourly and per-GB data processing charge, so watch the cost.

Q11. Why do most teams use a NAT gateway rather than a NAT instance today? Fresher

A NAT gateway is managed by AWS. It scales automatically, is highly available inside its Availability Zone, and needs no patching.

A NAT instance is a normal EC2 instance that you configure for NAT. You must patch it, size it, handle failover, and turn off the source/destination check.

Today almost everyone uses NAT gateways. A NAT instance may be used only for very low-cost labs.

Q12. What is a bastion host? Fresher

A bastion host (or jump box) is a small hardened server in a public subnet. Admins SSH to it first and then jump to private servers.

Today, a better option is often AWS Systems Manager Session Manager. It gives shell access without opening port 22 and without a bastion, and it logs sessions.

If you use a bastion, allow SSH only from your office or VPN IP, and use key pairs, not passwords.

Q13. What is the difference between ALB and NLB in one line each? Fresher

ALB (Application Load Balancer) works at layer 7. It understands HTTP and HTTPS, so it can route by path, such as /api, or by host name.

NLB (Network Load Balancer) works at layer 4. It handles TCP, UDP and TLS with very high performance and gives a static IP per Availability Zone.

Choose ALB for websites and microservices. Choose NLB for non-HTTP traffic, very high throughput, or when clients need fixed IPs.

Q14. What does Amazon Route 53 do? Fresher

Route 53 is AWS's DNS service. It has three main jobs:

  • Domain registration: buy and manage domain names.
  • DNS hosting: answer DNS queries using hosted zones and records such as A, AAAA, CNAME, MX and TXT.
  • Health checks and routing: send users to healthy endpoints using policies such as failover, weighted and latency-based routing.

The name comes from DNS port 53.

Q15. What is the difference between a CNAME record and an alias record in Route 53? Fresher

A CNAME points one name to another name. You cannot use a CNAME at the zone apex, such as example.com.

An alias record is a Route 53 feature. It points a name to an AWS resource such as an ALB, a CloudFront distribution or an S3 website endpoint. It works at the zone apex too.

Alias queries to AWS resources are free, and Route 53 follows the resource's IP changes automatically.

So use alias for AWS targets and CNAME for other domains.

Q16. What is the default VPC? Fresher

AWS creates a default VPC in each Region of a new account. It has a /16 range (172.31.0.0/16), one public default subnet in each Availability Zone, an internet gateway and a route to it.

Instances launched in a default subnet get a public IP by default, so they can reach the internet at once.

It is good for quick tests. For real projects, create your own VPC with planned public and private subnets.

Q17. What are VPC Flow Logs? Fresher

VPC Flow Logs record information about IP traffic going to and from network interfaces in your VPC.

Each record shows source and destination IP, ports, protocol, packets, bytes and whether the traffic was ACCEPT or REJECT.

You can create them for a VPC, a subnet or a single network interface, and send them to CloudWatch Logs, S3 or Firehose.

They do not record packet contents. They are used for troubleshooting, security analysis and finding unexpected traffic.

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. Which services use gateway endpoints, which use interface endpoints, and how do their costs differ? Mid level

Both let resources in a VPC reach AWS services privately, without an internet gateway or NAT.

A gateway endpoint works only for Amazon S3 and DynamoDB. You add it as a target in route tables. It has no hourly charge.

An interface endpoint uses AWS PrivateLink. It creates elastic network interfaces with private IPs in your subnets. It supports many services, such as SQS, Secrets Manager and ECR. It has hourly and per-GB charges.

Using endpoints can also save money on NAT gateway data processing.

Q19. Why is VPC peering not transitive? Mid level

If VPC A is peered with B, and B is peered with C, A still cannot talk to C through B.

AWS designed peering as a direct, private link between exactly two VPCs. Traffic cannot pass through a middle VPC.

So you must create a direct peering between A and C, with routes on both sides.

When you have many VPCs, the number of peerings grows very fast. Then a Transit Gateway is easier, because each VPC attaches once to a central hub.

Q20. What are the steps to make VPC peering work? Mid level

Follow these steps:

  • Make sure the CIDR ranges do not overlap.
  • Create the peering request from one VPC and accept it in the other. It works across accounts and Regions too.
  • Add routes in both VPCs' route tables. Example: in VPC A, 10.20.0.0/16 → pcx-0abc..., and the reverse in VPC B.
  • Allow the traffic in security groups and NACLs on both sides.
  • Optionally turn on DNS resolution for the peering, so private DNS names resolve to private IPs.

Missing the route on one side is the most common mistake.

Q21. When should you choose AWS Transit Gateway over VPC peering? Mid level

Transit Gateway is a regional network hub. VPCs, VPN connections and Direct Connect gateways attach to it.

Why: with 20 VPCs, full peering needs 190 connections. With Transit Gateway, each VPC attaches once.

It has its own route tables, so you can separate traffic. For example, prod VPCs and dev VPCs can both reach a shared services VPC but not each other.

It supports peering between Transit Gateways in different Regions. It has charges per attachment hour and per GB processed.

Q22. What is AWS PrivateLink and when do you use it? Mid level

PrivateLink lets you expose a service in one VPC to other VPCs privately, without peering, internet or NAT.

The provider puts the service behind a Network Load Balancer (or other supported targets) and creates an endpoint service. Consumers create an interface endpoint in their own VPC.

Benefits: only the one service is shared, not the whole network. Overlapping CIDRs are fine, because traffic goes through endpoint IPs in the consumer's subnet.

It is common for SaaS products and shared internal APIs.

Q23. What is the difference between Site-to-Site VPN and AWS Direct Connect? Mid level

Site-to-Site VPN creates encrypted IPsec tunnels over the internet between your office and AWS. It is quick to set up. Each connection has two tunnels for redundancy. Speed and delay depend on the internet.

Direct Connect is a private, dedicated network link from your data centre or a partner location to AWS. It gives more consistent speed and lower data transfer costs, but takes weeks to set up.

Common design: Direct Connect as the main link and VPN as the backup.

Q24. What are ephemeral ports and why do they matter for NACLs? Mid level

When a client connects to a server, the client uses a random high source port, called an ephemeral port. The reply comes back to that port.

Different systems use different ranges. Linux often uses 32768 to 60999, and Windows uses 49152 to 65535. AWS commonly suggests allowing 1024 to 65535.

Because NACLs are stateless, if you allow inbound port 443 but block outbound ephemeral ports, the reply is dropped and the website seems to hang.

Security groups are stateful, so they do not have this problem.

Q25. How does a route table choose a route when two routes match? Mid level

AWS uses longest prefix match. The most specific route wins.

Example route table:

  • 10.0.0.0/16 → local
  • 10.0.5.0/24 → pcx-11aa (peering)
  • 0.0.0.0/0 → nat-22bb

Traffic to 10.0.5.20 matches 0.0.0.0/0 and 10.0.5.0/24. The /24 is more specific, so it goes to the peering connection.

Traffic to 8.8.8.8 matches only the default route, so it goes to the NAT gateway.

Q26. How do you give private subnets in three Availability Zones high-availability internet access? Mid level

Create one NAT gateway in a public subnet in each Availability Zone.

Then give each private subnet its own route table that points 0.0.0.0/0 to the NAT gateway in the same AZ.

Why: a standard NAT gateway lives in one AZ. If all private subnets use one NAT gateway and that AZ fails, every subnet loses internet access. Same-AZ routing also avoids cross-AZ data charges.

For low-cost dev setups, one NAT gateway is acceptable if you accept the risk. Also check the current VPC documentation for newer NAT gateway availability options.

Q27. What is an egress-only internet gateway? Mid level

It is for IPv6 only. It lets instances send IPv6 traffic out to the internet and receive replies, but blocks the internet from starting IPv6 connections to them.

Why it is needed: IPv6 addresses in AWS are globally unique, and there is no NAT for IPv6. So the egress-only gateway does the "outbound-only" job that a NAT gateway does for IPv4.

Route example: ::/0 → eigw-0abc... in the private subnet's route table.

Q28. How does DNS work inside a VPC? Mid level

Each VPC has the Amazon-provided DNS server, called the Route 53 Resolver. It is reachable at the VPC CIDR base plus two, such as 10.0.0.2, and also at 169.254.169.253.

Two VPC settings matter:

  • enableDnsSupport: lets the VPC use the Amazon DNS server.
  • enableDnsHostnames: gives instances public DNS names if they have public IPs.

Private hosted zones in Route 53 let you create internal names, such as db.internal.example, that only resolve inside linked VPCs.

Q29. How do you connect on-premises DNS with AWS private DNS? Mid level

Use Route 53 Resolver endpoints.

  • An inbound endpoint lets on-premises DNS servers forward queries to AWS, so office users can resolve private hosted zone names.
  • An outbound endpoint with forwarding rules lets VPC resources resolve office domain names, such as corp.example.internal, by sending those queries to on-premises DNS servers.

The connection between them runs over VPN or Direct Connect.

Q30. What is the difference between Route 53 failover, weighted and latency routing? Mid level

Failover routing sends traffic to the primary record while its health check passes, and to the secondary record when it fails. It is used for active-passive DR.

Weighted routing splits traffic by weights, such as 90 and 10. It is used for canary releases or A/B tests.

Latency routing sends users to the Region with the lowest network delay for them.

All three can use health checks so unhealthy endpoints are removed from answers.

Q31. How does CloudFront keep an S3 bucket private while serving its files? Mid level

Use Origin Access Control (OAC).

  • Keep the bucket private with Block Public Access on.
  • Create an OAC and attach it to the CloudFront S3 origin.
  • Add a bucket policy that allows s3:GetObject only for the principal cloudfront.amazonaws.com, with a condition that AWS:SourceArn equals your distribution ARN.

Now users can read files only through CloudFront, which also gives HTTPS, caching and WAF. OAC replaces the older Origin Access Identity (OAI) for new setups.

Q32. What is a security group reference and why is it better than IP rules? Mid level

Instead of allowing an IP range, a rule can allow traffic from another security group.

Example: the database group allows port 5432 from the security group sg-app. Any instance with sg-app can connect, and no other instance can.

Why it is better: instances in Auto Scaling groups change IPs all the time. A group reference keeps working without editing rules. It also documents intent clearly: app tier to DB tier.

It works within a VPC and across peered VPCs in the same Region.

Q33. How do you check what a security group allows using the CLI? Mid level

Use describe-security-groups with a query to keep the output short.

aws ec2 describe-security-groups --group-ids sg-0a1b2c3d4e5f67890 --query "SecurityGroups[0].IpPermissions[].{port:FromPort,proto:IpProtocol,cidr:IpRanges[0].CidrIp,sg:UserIdGroupPairs[0].GroupId}" --output table

Output:

-------------------------------------------------------------
|                  DescribeSecurityGroups                   |
+-------------+--------+---------+-------------------------+
|    cidr     | port   | proto   |           sg            |
+-------------+--------+---------+-------------------------+
|  None       |  5432  |  tcp    |  sg-0123456789abcdef0   |
|  10.0.0.0/16|  22    |  tcp    |  None                   |
+-------------+--------+---------+-------------------------+

port 5432 is open only from one security group, and SSH is open only inside the VPC. Nothing is open to 0.0.0.0/0.

Q47. What is AWS Global Accelerator and how is it different from CloudFront? Mid level

Global Accelerator gives you two static anycast IP addresses. User traffic enters the AWS global network at the nearest edge location and travels on AWS's network to your endpoints, such as ALBs, NLBs or EC2 instances.

CloudFront is a content delivery network. It caches HTTP content at edge locations.

Simple difference: CloudFront is for caching web content. Global Accelerator is for speeding up and failing over TCP or UDP traffic without caching, for example gaming, VoIP or APIs that need fixed IPs.

Q48. How do you read a VPC Flow Log record to find blocked traffic? Mid level

A default-format record looks like this:

Output:

2 111122223333 eni-0a1b2c3d 203.0.113.25 10.0.1.15 51544 22 6 3 180 1763550000 1763550060 REJECT OK

Read it field by field: version 2, account, network interface, source IP 203.0.113.25, destination IP 10.0.1.15, source port 51544, destination port 22, protocol 6 (TCP), 3 packets, 180 bytes, start and end time, action REJECT, log status OK.

someone from 203.0.113.25 tried SSH to 10.0.1.15 and was blocked by a security group or NACL. If you expected this to work, check those rules for port 22.

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. An EC2 instance in a private subnet cannot reach the internet. How do you troubleshoot? Senior

Follow the packet from the instance outward.

  • Route table of the private subnet: is there 0.0.0.0/0 → nat-...?
  • NAT gateway: is it in the Available state, in a public subnet, and does it have an Elastic IP?
  • Public subnet route table (where the NAT lives): does it have 0.0.0.0/0 → igw-...?
  • Security group of the instance: is outbound traffic allowed?
  • NACLs on both subnets: are outbound 443 and inbound ephemeral ports allowed?
  • DNS: does nslookup example.com work? Check enableDnsSupport.
  • Finally, use VPC Reachability Analyzer to test the path and see exactly which hop blocks it.
Q35. You cannot SSH to a new EC2 instance. Walk through your checks. Senior

Check from the outside in.

  • Does the instance have a public IP or Elastic IP, and is it in a subnet with a route to an internet gateway?
  • Does the security group allow TCP 22 from your current public IP?
  • Do the NACLs allow inbound 22 and outbound ephemeral ports?
  • Are you using the right key and user name, such as ec2-user for Amazon Linux or ubuntu for Ubuntu?
  • Are the key file permissions correct? Run chmod 400 key.pem.
  • Did the instance pass both status checks?

If the network is fine, use EC2 Instance Connect or Session Manager to get in and check the sshd service.

Q36. Two teams want to connect VPCs that use the same CIDR 10.0.0.0/16. What options do you have? Senior

VPC peering and normal Transit Gateway routing do not work with overlapping CIDRs. Options:

  • Best long-term fix: re-plan IP ranges with a central IPAM, and migrate one VPC. This is slow but clean.
  • PrivateLink: if only a few services need to be shared, expose them with an endpoint service. Overlap does not matter.
  • Private NAT gateway: give each VPC a small non-overlapping "routable" range, and translate traffic through a private NAT gateway before it goes to the Transit Gateway.

Explain the trade-offs: PrivateLink is simple for one-way service access, while NAT adds cost and complexity.

Q37. How would you design a VPC for a three-tier production application? Senior

Use one VPC with a planned range, such as 10.10.0.0/16, across at least two, preferably three, Availability Zones.

  • Public subnets: ALB and NAT gateways only.
  • Private app subnets: EC2 or containers in an Auto Scaling group.
  • Private data subnets: RDS Multi-AZ and ElastiCache, with no internet route.
  • Security groups chained: internet → ALB on 443, ALB → app on the app port, app → DB on the DB port.
  • Gateway endpoints for S3 and DynamoDB, interface endpoints for services like Secrets Manager.
  • Flow Logs on, access through Session Manager, and spare IP space for growth.
Q38. Your NAT gateway bill is very high. How do you find the cause and reduce it? Senior

First find who is sending the traffic.

  • Check the NAT gateway CloudWatch metrics such as BytesOutToDestination.
  • Use VPC Flow Logs to find the top source instances and destinations.

Common causes and fixes:

  • Large S3 or DynamoDB traffic through NAT: add free gateway endpoints.
  • Pulling container images from ECR, or calling other AWS services: add interface endpoints where the saving is bigger than the endpoint cost.
  • Cross-AZ traffic to a NAT in another AZ: use one NAT per AZ.
  • Chatty software updates: use a local mirror or cache.
Q39. How do you inspect all traffic between VPCs and to the internet centrally? Senior

Build an inspection VPC.

  • Attach all VPCs to a Transit Gateway.
  • Route traffic from spoke VPCs to an inspection VPC that runs AWS Network Firewall or third-party appliances behind a Gateway Load Balancer.
  • Turn on appliance mode on the inspection VPC attachment so that both directions of a flow go through the same appliance AZ.
  • Send internet-bound traffic through central egress NAT gateways after inspection.

Mention trade-offs: more cost and latency, but one place for rules and logs.

Q40. Users in India see slow responses from your app in us-east-1. What network options can help? Senior

Look at the cause first. Is it static files, dynamic API calls or the database?

  • Static content: put CloudFront in front, so files are cached at edge locations near users.
  • Dynamic content: CloudFront still helps through persistent connections and the AWS backbone. AWS Global Accelerator can help for TCP or UDP apps by entering the AWS network near the user.
  • Data and app: deploy a copy in ap-south-1 (Mumbai) and use Route 53 latency routing. This needs a plan for data replication.

Measure before and after with real user metrics.

Q41. How do you troubleshoot intermittent timeouts between two microservices in the same VPC? Senior

Intermittent problems often come from limits, not rules.

  • Check whether failures come from one AZ or one target. Look at load balancer metrics such as TargetConnectionErrorCount and UnHealthyHostCount.
  • Check VPC Flow Logs for REJECT records. A stateless NACL can block some ephemeral ports.
  • Check idle timeouts. If the load balancer idle timeout is longer than the app's keep-alive, the app may close connections that the load balancer still reuses.
  • Check DNS caching after targets change.
  • Check instance network limits, such as PPS and connection tracking allowances, using ENA statistics.

Fix the root cause and add an alarm for it.

Q42. What is VPC Reachability Analyzer and when do you use it? Senior

Reachability Analyzer is a configuration analysis tool. You give it a source and a destination, such as an instance and an internet gateway, and a port.

It checks route tables, security groups, NACLs, gateways and peering, and tells you whether the path is reachable. If not, it names the blocking component, such as "security group sg-0abc does not allow port 443".

It does not send real packets, so it is safe in production. Use it in troubleshooting and after network changes.

Q43. How do you secure access to S3 so it is only possible from your VPC? Senior

Combine an endpoint with policies.

  • Create an S3 gateway endpoint and add it to private route tables.
  • Add a bucket policy that denies all access unless aws:SourceVpce equals your endpoint ID, with an exception for an admin role so you do not lock yourself out.
  • Add an endpoint policy that allows access only to your company's buckets. This stops data being copied to a personal bucket.
  • Keep Block Public Access on.

Explain that this protects against both outside access and data exfiltration from inside.

Q44. How do you plan IP addresses for a company with many accounts and Regions? Senior

Use Amazon VPC IP Address Manager (IPAM) and a written plan.

  • Reserve a large private block, such as 10.0.0.0/8, and split it by Region, then by environment, for example 10.16.0.0/12 for Mumbai.
  • Create IPAM pools and allow accounts to get CIDRs only from their pool. This prevents overlaps.
  • Leave room for growth and for future VPCs.
  • Document which ranges are used by on-premises networks.

Good planning avoids painful migrations later, because overlapping CIDRs cannot be peered.

Q45. A website on an ALB returns 504 Gateway Timeout. What does it mean and how do you fix it? Senior

504 means the load balancer did not get a response from the target in time.

Checks:

  • Is the target's work slower than the ALB idle timeout, which is 60 seconds by default? Look at TargetResponseTime.
  • Can the ALB reach the target? Check the target security group allows the ALB's security group on the target port.
  • Is the app overloaded or stuck on a slow database query?
  • Check ALB access logs for the target and timing fields.

Fixes: speed up the slow call, add capacity, move long jobs to a queue, or raise the idle timeout only if it is truly needed.

Q46. How would you set up hybrid connectivity with high availability between an office and AWS? Senior

Use two different paths.

  • Primary: two Direct Connect connections at different Direct Connect locations, connected to a Direct Connect gateway and then to a Transit Gateway.
  • Backup: Site-to-Site VPN to the Transit Gateway over the internet.
  • Use BGP so routes fail over automatically. Prefer Direct Connect routes using BGP attributes.
  • Test failover regularly by disabling one path in a maintenance window.

AWS publishes resiliency recommendations for Direct Connect. Mention that the right level depends on how critical the workload is.

Q49. How do you allow private servers to reach only approved internet domains? Senior

A NAT gateway alone allows any destination. Add filtering.

  • AWS Network Firewall: create stateful rules with a domain allow list, such as .amazonaws.com and the package mirror domain, and block everything else. Route private subnet traffic through the firewall before the NAT gateway.
  • Route 53 Resolver DNS Firewall: block DNS lookups for domains not on the allow list. This also helps stop data exfiltration through DNS.
  • Use VPC endpoints for AWS services so that traffic does not need the internet at all.

Log the denied requests and review them before you switch to strict blocking.

Q50. How do you design the network so that one Availability Zone failure does not take the app down? Senior

Make every network component zonal-redundant.

  • Subnets in at least two, better three, AZs for each tier.
  • Load balancers enabled in all those AZs.
  • One NAT gateway per AZ, with each private route table pointing to its own AZ's NAT.
  • Interface endpoints with a subnet in each AZ.
  • Auto Scaling groups spread across all AZs, with enough spare capacity to handle the loss of one AZ.
  • Databases with Multi-AZ.

Then test it. For example, use AWS Fault Injection Service to simulate an AZ problem and check that traffic shifts.

5. Frequently asked questions

Do I need to know subnet maths for AWS interviews?

Yes, the basics. You should know that a /24 has 256 addresses and AWS reserves 5 in each subnet, so 251 are usable. You should also be able to split a /16 into /24 subnets.

What is the most common networking scenario question?

"My EC2 instance cannot reach the internet" and "I cannot SSH to my instance". Practise both until you can list the checks in order without thinking.

Should a fresher learn Transit Gateway and Direct Connect?

Know what they are and when to use them. Deep design questions about them are usually for mid and senior roles.

6. Quick revision

  • Public subnet means its route table has a route to an internet gateway.
  • Security groups are stateful. NACLs are stateless and need return-traffic rules.
  • Private instances reach the internet through a NAT gateway, and reach S3 privately through a gateway endpoint.
  • VPC peering is not transitive. Transit Gateway is a hub that can route between many VPCs.
  • Most outages are a missing route, a closed port or a DNS mistake.

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