AWS EC2, EBS, Auto Scaling and Load Balancer Interview Questions and Answers (50 Questions)
This page has 50 new interview questions on EC2, EBS, Auto Scaling and Elastic Load Balancing, with full answers. Compute questions appear in almost every AWS, DevOps and cloud support interview, from fresher to architect level.
1. An everyday example: a taxi company
EC2 is still the base of many company systems. Interviewers check if you can choose the right size, keep data safe on disks, scale with traffic and spread load without downtime.
Think of a taxi company. EC2 instances are the taxis. The instance type is the car model: small hatchback or big SUV. The AMI is the standard fitting done on every new car. EBS volumes are the boot space that stays with the car. The Auto Scaling group is the manager who adds taxis in rush hour and sends them home at night. The load balancer is the dispatcher who gives each new customer to a free, healthy taxi.
How to use this page
- Answer each question aloud first, then compare.
- Learn the numbers that matter, such as gp3 baseline performance, but say "check the current quota" for limits that can change.
- Practise the read-only CLI commands in a practice account and stop instances after labs.
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 an EC2 instance type and how do you read a name like m7g.large? Fresher
An instance type decides the CPU, memory, storage and network of a server.
Read m7g.large like this:
- m: the family, general purpose.
- 7: the generation. Higher is newer and usually better value.
- g: an extra attribute. g means AWS Graviton (Arm) processor. Others include i for Intel, a for AMD, d for local NVMe disks and n for extra networking.
- large: the size. Sizes go up like large, xlarge, 2xlarge, and each step roughly doubles resources.
Q2. What are the main EC2 pricing options? Fresher
The main options are:
- On-Demand: pay per second or hour with no commitment. Good for short or unknown workloads.
- Savings Plans: commit to a dollar amount per hour for 1 or 3 years and get a lower price.
- Reserved Instances: commit to an instance configuration for 1 or 3 years.
- Spot Instances: use spare capacity at a big discount, but AWS can take it back with a two-minute warning.
- Dedicated Hosts and Dedicated Instances: hardware not shared with other customers, for licensing or compliance.
- On-Demand Capacity Reservations: reserve capacity in an AZ, without a discount by themselves.
Q3. What is the difference between stopping, hibernating and terminating an instance? Fresher
Stop: the instance shuts down. EBS volumes stay, and you pay for storage but not for compute. When you start it again, it may move to new hardware and gets a new public IP unless it has an Elastic IP.
Hibernate: like stop, but the RAM is saved to the encrypted EBS root volume. On start, apps continue from where they were.
Terminate: the instance is deleted. The root EBS volume is deleted by default (DeleteOnTermination is true). Other volumes stay unless set to delete.
Q4. What is an AMI? Fresher
An AMI (Amazon Machine Image) is a template used to launch EC2 instances.
It contains the operating system, settings, and often your installed software, plus block device mappings that point to EBS snapshots.
Everyday example: a cake mould. Every cake made from it has the same shape.
AMIs are Regional. To launch in another Region, copy the AMI there. You can keep AMIs private, share them with chosen accounts, or make them public.
Q5. What is EC2 user data? Fresher
User data is a script or cloud-init configuration you give at launch. By default, it runs once as root on the first boot.
It is used to install packages, write config files or start an app.
#!/bin/bash
dnf -y install nginx
systemctl enable --now nginxIf the script fails, check /var/log/cloud-init-output.log on the instance. User data is not encrypted, so never put passwords or keys in it.
Q6. What is a key pair in EC2? Fresher
A key pair is used to log in to Linux instances with SSH, and to get the Windows administrator password.
AWS stores the public key and places it on the instance. You keep the private key file, such as demo-key.pem. AWS does not keep a copy of the private key, so if you lose it, you cannot download it again.
Keep the file safe and set its permission with chmod 400 demo-key.pem. Many teams now use Session Manager or EC2 Instance Connect instead of long-lived keys.
Q7. What is the difference between EBS and instance store? Fresher
EBS is network block storage. It is persistent. Data stays when you stop the instance, and you can take snapshots and detach the volume.
Instance store is a disk physically attached to the host. It is very fast, but temporary. Data is lost when the instance stops, hibernates or terminates, or when the underlying disk fails.
Use instance store for caches, buffers and scratch data. Use EBS for operating systems and data you must keep.
Q8. What EBS volume types are there? Fresher
There are two groups.
SSD types, for transactional work:
- gp3: general purpose, the default choice for most workloads.
- gp2: older general purpose, performance grows with size.
- io2 Block Express and io1: Provisioned IOPS for demanding databases.
HDD types, for large sequential reads and writes:
- st1: throughput optimised, for big data and logs.
- sc1: cold HDD, lowest cost, for rarely used data.
st1 and sc1 cannot be boot volumes.
Q9. What is an EBS snapshot? Fresher
A snapshot is a point-in-time backup of an EBS volume. AWS stores it durably, and you do not manage the storage.
Snapshots are incremental. The first one copies all used blocks. Later ones save only the blocks that changed.
You can create new volumes from a snapshot in any AZ of the same Region, copy snapshots to other Regions, and automate them with Amazon Data Lifecycle Manager or AWS Backup.
Q10. Can you attach an EBS volume to an instance in another Availability Zone? Fresher
No. An EBS volume lives in one Availability Zone and can be attached only to instances in the same AZ.
To move data to another AZ:
- Take a snapshot of the volume.
- Create a new volume from the snapshot in the target AZ.
- Attach it to the instance there.
The same idea, with a snapshot copy, moves data to another Region.
Q11. What are EC2 status checks? Fresher
EC2 runs automatic checks every minute.
- System status check: problems with AWS hardware, power or network of the host. Usually AWS must fix it. Stopping and starting the instance moves it to new hardware.
- Instance status check: problems inside your instance, such as a wrong network config, a full disk or a kernel problem. You must fix it.
- Attached EBS status check: problems reaching the instance's EBS volumes.
You can create a CloudWatch alarm that recovers or reboots the instance when a check fails.
Q12. How does an Auto Scaling group use minimum, maximum and desired capacity? Fresher
An Auto Scaling group (ASG) is a set of EC2 instances that AWS manages as one unit.
You set three numbers: minimum, maximum and desired capacity. The ASG always tries to keep the desired number of healthy instances.
If an instance fails a health check, the ASG replaces it. Scaling policies change the desired number based on load, such as CPU or requests.
It uses a launch template to know what kind of instance to start.
Q13. What is a launch template? Fresher
A launch template stores the settings to launch an instance: AMI ID, instance type, key pair, security groups, IAM instance profile, user data, storage and tags.
It supports versions, so you can create version 2 with a new AMI and roll back to version 1 if needed.
Auto Scaling groups, EC2 Fleet and the launch-instance console all use launch templates. Launch configurations are the old method, and AWS recommends launch templates instead.
Q14. What does a load balancer do? Fresher
A load balancer receives traffic from users and spreads it across many healthy targets, such as EC2 instances, containers or IP addresses.
Everyday example: a bank token system that sends each customer to the next free counter.
It also runs health checks and stops sending traffic to unhealthy targets. It can handle HTTPS certificates, so the servers do not need to.
AWS offers Application Load Balancer, Network Load Balancer and Gateway Load Balancer.
Q15. What can a target group contain, and how does a listener pick the right target group? Fresher
A target group is a list of targets that a load balancer sends traffic to, such as instances, IP addresses or Lambda functions.
Each target group has its own protocol, port and health check settings, such as path /health and the expected success code.
A listener rule decides which target group gets a request. For example, /api goes to the api-tg target group, and everything else goes to the web-tg target group.
Q16. What is an Elastic Network Interface (ENI)? Fresher
An ENI is a virtual network card. It has a primary private IP, optional secondary IPs, a MAC address, security groups and optionally a public IP.
Every instance has a primary ENI that cannot be detached. You can add more ENIs, depending on the instance type limit.
A secondary ENI can be moved to another instance in the same AZ. This was used for simple failover, keeping the same private IP.
Q17. How do you list running instances with their names using the CLI? Fresher
Use describe-instances with a filter and a query.
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query "Reservations[].Instances[].{id:InstanceId,type:InstanceType,az:Placement.AvailabilityZone,name:Tags[?Key=='Name']|[0].Value}" --output tableOutput:
----------------------------------------------------------------
| DescribeInstances |
+-------------+-----------------------+------------+------------+
| az | id | name | type |
+-------------+-----------------------+------------+------------+
| ap-south-1a| i-0a1b2c3d4e5f60001 | web-1 | t3.small |
| ap-south-1b| i-0a1b2c3d4e5f60002 | web-2 | t3.small |
+-------------+-----------------------+------------+------------+Two running web servers in two different AZs. This is a quick way to check spread and sizes.
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 does gp3 performance work compared with gp2? Mid level
gp3 gives a baseline of 3,000 IOPS and 125 MiB/s at any size, included in the price. You can provision more IOPS and throughput separately from size. Current AWS documentation lists gp3 up to 80,000 IOPS, 2,000 MiB/s and 64 TiB.
gp2 performance depends on size: 3 IOPS per GiB, with burst credits for small volumes. A small gp2 volume can run out of burst credits and become slow.
gp3 is usually cheaper per GiB too. So most teams move gp2 volumes to gp3 using Elastic Volumes, without downtime.
Q19. How do you change an EBS volume's size or type without downtime? Mid level
Use Elastic Volumes.
aws ec2 modify-volume --volume-id vol-0a1b2c3d4e5f67890 --size 200 --volume-type gp3AWS starts the change while the volume stays attached and in use. Watch the state go from modifying to optimizing to completed.
Then grow the partition and filesystem inside the OS, for example sudo growpart /dev/nvme0n1 1 and then sudo xfs_growfs -d / for XFS or sudo resize2fs for ext4.
Note: you cannot shrink an EBS volume. After a change, you must wait before you can modify the same volume again.
Q20. What are placement groups? Mid level
Placement groups control how instances are placed on hardware.
- Cluster: instances close together in one AZ for very low latency and high network speed. Used for HPC. Risk: one hardware problem can affect many.
- Spread: each instance on different hardware. A spread group can have up to 7 running instances per AZ. Used for small sets of critical instances.
- Partition: instances split into partitions that do not share racks. Used for big distributed systems such as Kafka, HDFS or Cassandra.
Q21. What is the difference between target tracking, step and scheduled scaling? Mid level
Target tracking: you pick a metric and a target value, such as average CPU at 50 percent. The ASG adds or removes instances to stay near the target. It is the easiest and most common.
Step scaling: you define CloudWatch alarms and steps, such as add 2 instances when CPU is over 70 and add 4 when over 90.
Scheduled scaling: change capacity at known times, such as 9 AM on weekdays.
Predictive scaling: uses past patterns to scale before the load arrives.
Q22. What is the health check grace period in an Auto Scaling group? Mid level
It is the time the ASG waits after an instance starts before it checks the instance's health.
Why: an app may need a few minutes to install and start. Without a grace period, the ASG may mark a new instance unhealthy and kill it again and again.
Set it a little longer than your real boot and warm-up time. Also enable ELB health checks on the ASG, so instances that fail the load balancer check are replaced, not only those that fail EC2 status checks.
Q23. What are Auto Scaling lifecycle hooks? Mid level
Lifecycle hooks pause an instance during launch or termination so you can run custom actions.
- On launch: the instance waits in Pending:Wait. You can install software, register with a tool or warm a cache, and then send CompleteLifecycleAction.
- On termination: the instance waits in Terminating:Wait. You can copy logs, drain jobs or deregister it.
If you do not complete the action, the hook times out and the default result, CONTINUE or ABANDON, is used.
Q24. How does an ASG decide which instance to terminate when it scales in? Mid level
With the default termination policy, the ASG first chooses the Availability Zone with the most instances, to keep the AZs balanced.
Inside that AZ, it prefers instances that use the oldest launch template or configuration, then instances closest to the next billing hour, then picks randomly.
You can change this with policies such as OldestInstance, NewestInstance or OldestLaunchTemplate, or with a custom Lambda policy. Use instance scale-in protection to protect instances doing important work.
Q25. What is instance refresh in an Auto Scaling group? Mid level
Instance refresh replaces instances in an ASG in a rolling way. It is used after you change the launch template, for example a new AMI with security patches.
You set a minimum healthy percentage, such as 90 percent, and a warm-up time. AWS replaces a batch, waits for health, and then continues.
You can add checkpoints, skip matching instances, and use auto rollback if the new instances fail.
aws autoscaling start-instance-refresh --auto-scaling-group-name web-asg --preferences '{"MinHealthyPercentage":90,"InstanceWarmup":120}'Q26. How do you use Spot Instances safely? Mid level
Use Spot only for workloads that can be interrupted, such as batch jobs, CI builds, stateless web tiers or containers.
- Diversify across many instance types and AZs, for example with an ASG mixed instances policy.
- Use the price-capacity-optimized allocation strategy.
- Handle the two-minute interruption notice. Read it from instance metadata or EventBridge, then drain and save work.
- Turn on Capacity Rebalancing so the ASG starts a replacement when there is a rebalance recommendation.
- Keep a base of On-Demand instances for the minimum load.
Q27. What is the difference between ALB and NLB health checks and cross-zone load balancing? Mid level
Health checks: ALB checks HTTP or HTTPS, with a path and expected codes. NLB can check TCP, HTTP or HTTPS.
Cross-zone load balancing spreads traffic evenly across all targets in all enabled AZs.
- ALB: cross-zone is on by default at the load balancer level, and there is no extra inter-AZ charge for it.
- NLB: cross-zone is off by default. If you turn it on, normal inter-AZ data charges apply.
Without cross-zone, each AZ node sends traffic only to targets in its own AZ, so uneven targets per AZ give uneven load.
Q28. What is deregistration delay (connection draining)? Mid level
When a target is removed or becomes unhealthy, the load balancer stops sending new requests to it, but lets in-flight requests finish for a set time.
The default is 300 seconds. You can set it from 0 to 3600 seconds.
If your requests are short, lower it to 30 to 60 seconds so deployments and scale-in run faster. If you have long uploads or downloads, keep it longer, so users are not cut off.
Q29. What are ALB listener rules? Mid level
A listener checks for connections on a port, such as 443. Its rules decide what to do with each request.
Rules can match conditions like host header (api.example.com), path (/images/*), HTTP method, query string, source IP or HTTP header.
Actions can forward to target groups (with weights), redirect (for example HTTP to HTTPS), return a fixed response, or authenticate users with Cognito or an OIDC provider.
Rules are checked in priority order, and the default rule is used last.
Q30. How do you shift traffic gradually from a blue to a green target group on an ALB? Mid level
Run the old version (blue) and the new version (green) in two target groups.
- Deploy green and check its health with test traffic.
- Use weighted forwarding in the listener rule, for example blue 90 and green 10.
- Watch errors and latency, then move to 50/50 and then 0/100.
- If something goes wrong, move the weight back to blue at once.
Tools like CodeDeploy can automate this. It gives fast rollback and near-zero downtime.
Q31. What is the difference between EBS-backed and instance store-backed AMIs? Mid level
An EBS-backed AMI has its root volume on EBS. The instance can be stopped and started, boots faster, and keeps root data when stopped. This is the normal choice today.
An instance store-backed AMI has its root device on an instance store volume. The instance cannot be stopped, only rebooted or terminated, and root data is lost on termination.
Almost all modern AMIs are EBS-backed.
Q32. How do you make EBS encryption the default? Mid level
Turn on "EBS encryption by default" in each Region of the account. It is a Regional setting.
After that, all new EBS volumes and snapshot copies in that Region are encrypted, using the default key aws/ebs or a customer managed KMS key you choose.
aws ec2 enable-ebs-encryption-by-default --region ap-south-1Output:
{
"EbsEncryptionByDefault": true
}It does not encrypt existing volumes. To encrypt an old volume, take a snapshot, copy it with encryption, and create a new volume from it.
Q33. How do you choose the right EC2 instance size? Mid level
Measure, then decide.
- Watch CPU, memory, disk and network for at least two weeks. Memory needs the CloudWatch agent.
- Use AWS Compute Optimizer for right-sizing suggestions.
- Pick the family by the bottleneck: compute-bound to C, memory-bound to R, balanced to M.
- Try Graviton types for better price and performance if your software supports Arm.
- Load test the new size before production.
Remember that it is easier to scale out with more small instances than to keep growing one big server.
Q47. A t3 instance becomes slow every afternoon. What could be the reason? Mid level
T instances are burstable. They earn CPU credits when CPU use is below a baseline and spend credits when they burst above it.
In standard mode, if credits run out, the CPU is held at the baseline, so the app becomes slow.
Check the CloudWatch metrics CPUCreditBalance and CPUCreditUsage. If the balance drops to zero every afternoon, that is the cause.
Fixes: switch to unlimited mode (you pay extra for surplus credits), choose a larger T size, or move to a fixed-performance family such as M or C if the load is steady.
Q48. What is the difference between EC2 Instance Connect and Session Manager? Mid level
EC2 Instance Connect pushes a short-lived SSH public key to the instance (valid for about 60 seconds) and then you connect with SSH. Port 22 must still be reachable, for example through an Instance Connect Endpoint for private instances.
Session Manager, part of Systems Manager, gives a shell through the SSM Agent. No inbound port, no SSH keys and no bastion are needed. Sessions can be logged to S3 or CloudWatch Logs, and access is controlled by IAM.
For production, many companies prefer Session Manager because of the audit trail and no open ports.
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 instance fails its instance status check after a change in /etc/fstab. How do you recover it? Senior
A wrong fstab line can stop the boot. Options:
- First try the EC2 Serial Console, if it is enabled, to fix the file from a console session.
- Otherwise stop the instance, detach the root volume, and attach it to a rescue instance in the same AZ as a secondary volume.
- Mount it, edit /etc/fstab, and add
nofailto non-root volumes so a missing disk does not stop boot. - Detach it, attach it back as the root device name, and start the instance.
Always take a snapshot before you work on a broken root volume.
Q35. Users get 502 Bad Gateway from an ALB. What could be wrong? Senior
502 means the ALB got an invalid response, or the connection was closed or reset by the target.
Common causes:
- The app crashed or the web server process is not running.
- The target closed the connection because its keep-alive timeout is shorter than the ALB idle timeout. Set the server keep-alive higher than the ALB idle timeout.
- The response headers were malformed or too large.
- A Lambda target returned a bad response format.
Check ALB access logs for elb_status_code 502 and target_status_code, plus the app and web server logs.
Q36. Users get 503 Service Unavailable from an ALB. What does it usually mean? Senior
The common meaning is that the target group has no registered healthy targets to send the request to.
Checks:
- Does the target group have targets at all? Did the ASG scale to zero?
- Are all targets failing health checks? Check the health check path, port, expected code and the target's security group.
- Is the listener rule pointing to the right target group?
For Lambda targets, a 503 can also come from function throttling. Fix the health problem, and add an alarm on HealthyHostCount.
Q37. Your Auto Scaling group keeps launching and terminating instances in a loop. How do you debug it? Senior
This is often called flapping or a launch loop.
- Check the ASG activity history for the reason, for example "failed ELB health check".
- Is the health check grace period too short for boot time?
- Does the health check path return 200? Test it with curl on the instance.
- Does user data fail, so the app never starts? Read /var/log/cloud-init-output.log.
- Are scale-out and scale-in alarms too close, so they fight each other?
You can suspend the ReplaceUnhealthy process for a short time while you debug, then resume it.
Q38. How would you make a single legacy EC2 application server highly available without rewriting it? Senior
Step by step:
- Put configuration and data outside the server: database on RDS Multi-AZ, shared files on EFS, sessions in ElastiCache or the database.
- Build a golden AMI with the app installed.
- Put the server in an Auto Scaling group across two AZs behind an ALB.
- If the app cannot run as two copies at once, use an ASG with min 1, max 1 across two AZs. It is not zero-downtime, but it recovers automatically.
- Add health checks, alarms and backups, and test a failover.
Explain the trade-off between the effort and the recovery time you get.
Q39. Your EBS-backed database is slow. How do you find out whether storage is the bottleneck? Senior
Look at CloudWatch EBS metrics and OS tools together.
- VolumeQueueLength high and rising means requests are waiting.
- Compare VolumeReadOps and VolumeWriteOps with the provisioned IOPS, and throughput with the provisioned MiB/s.
- Check VolumeIdleTime and the volume's average latency metrics.
- On the instance, run
iostat -x 1and look at await and %util. - Check the instance EBS bandwidth limit too. A small instance type may cap total EBS throughput even if the volume can do more.
Fixes: raise gp3 IOPS or throughput, use io2 for very high needs, or move to a bigger EBS-optimized instance.
Q40. How do you patch 200 EC2 instances with minimum risk? Senior
Use AWS Systems Manager Patch Manager.
- Group instances with tags, such as PatchGroup=web-prod.
- Use patch baselines that approve patches after a few days.
- Use maintenance windows and rate controls, such as 10 percent at a time with an error threshold.
- Patch dev first, then staging, then production.
For Auto Scaling groups, a better approach is to bake a new AMI with EC2 Image Builder and run an instance refresh, instead of patching running servers.
Report compliance in Systems Manager and alert on failures.
Q41. How do you reduce EC2 costs for a steady 24x7 workload and a spiky workload? Senior
For the steady part:
- Right-size first with Compute Optimizer.
- Use Compute Savings Plans or Reserved Instances for the base usage.
- Try Graviton instance types.
For the spiky part:
- Use Auto Scaling with target tracking so you pay only during peaks.
- Use Spot for stateless parts of the extra capacity.
Also stop dev servers at night with scheduling, delete unattached EBS volumes and old snapshots, and move gp2 to gp3.
Q42. What is the difference between a warm pool and a larger minimum size in an ASG? Senior
A warm pool keeps pre-initialised instances ready in a Stopped, Running or Hibernated state. When the ASG scales out, it moves them in quickly instead of booting new ones from scratch.
A larger minimum keeps more instances in service all the time, taking traffic and costing full price.
Warm pools are useful when boot and warm-up take many minutes. Stopped warm instances cost only for EBS storage and attached IPs, so you get faster scaling at lower cost than running extra instances.
Q43. How would you design a fleet that must survive both an AZ failure and a Spot interruption wave? Senior
Combine capacity planning with diversity.
- Spread the ASG across three AZs.
- Size for N+1: if one AZ fails, the other two must handle full load.
- Keep an On-Demand base, for example 40 percent, and use Spot for the rest with many instance types.
- Turn on Capacity Rebalancing and handle interruption notices with graceful shutdown.
- Use target tracking with some headroom, such as 60 percent CPU target.
- Test with AWS Fault Injection Service, which can simulate Spot interruptions and AZ problems.
Q44. An instance was terminated by mistake. How could this have been prevented and how do you recover? Senior
Prevention:
- Turn on termination protection for important standalone instances.
- Use IAM policies that deny ec2:TerminateInstances on tagged production resources, or require MFA.
- Use Auto Scaling for app servers, so a lost instance is replaced automatically.
- Set DeleteOnTermination to false for data volumes.
Recovery:
- Launch a new instance from the latest AMI.
- Restore data volumes from the latest snapshot or AWS Backup recovery point.
- Check CloudTrail to see who terminated it and why.
Q45. How do you handle sticky sessions on an ALB, and what are the risks? Senior
Stickiness sends a user's requests to the same target, using a load-balancer cookie or an application cookie.
It helps old apps that store sessions in server memory.
Risks:
- Uneven load, because some targets keep heavy users.
- Users lose sessions when a target is replaced or scales in.
- It makes blue/green and scaling less smooth.
Better long-term fix: make the app stateless and store sessions in ElastiCache or DynamoDB. Then stickiness is not needed.
Q46. How do you migrate an EC2 workload from x86 to Graviton? Senior
Plan in small steps.
- Check that the OS, runtimes and libraries support Arm64. Most Linux distributions, Java, Python, Node.js and Go do.
- Build multi-architecture artifacts or container images.
- Test in a staging environment and compare performance and cost.
- Use a mixed instances ASG or a separate target group with a small traffic weight for canary testing.
- Watch error rates and latency, then shift fully.
Explain the benefit: AWS states Graviton offers better price performance for many workloads, but always measure with your own app.
Q49. How do you build an automated golden AMI pipeline? Senior
Use EC2 Image Builder or a similar tool like Packer in a pipeline.
- Start from the latest official base AMI, for example the newest Amazon Linux 2023 image from the public SSM parameter.
- Run build components: patch, harden, install agents such as the CloudWatch agent and SSM Agent, and install the app runtime.
- Run test components: boot test, CIS checks, vulnerability scan with Amazon Inspector.
- Distribute the AMI to required Regions and accounts, and share it with the right KMS key permissions.
- Update the launch template version and start an instance refresh.
- Run it on a schedule, such as every month, and keep old AMIs for rollback for a set time.
Q50. You expect a huge sale event next week. How do you make sure EC2 capacity is available? Senior
Plan capacity before the event.
- Check service quotas, such as On-Demand vCPU limits, and raise them early.
- Create On-Demand Capacity Reservations in the needed AZs and instance types for the event window. They guarantee capacity. Combine them with Savings Plans for the discount.
- Use scheduled scaling to raise the ASG minimum before the sale starts.
- Pre-warm caches, and check that the load balancer and database can take the load with a load test.
- Spread across several instance types in case one type is short.
After the event, cancel the reservations so you stop paying for them.
5. Frequently asked questions
Which EC2 topics are asked most often to freshers?
Instance types, pricing models, AMI, key pairs, security groups, EBS vs instance store, stop vs terminate, and user data.
Which topics are asked to experienced candidates?
Auto Scaling policies, lifecycle hooks, instance refresh, Spot strategies, EBS performance, load balancer errors such as 502 and 504, and right-sizing.
Do I need to remember every instance family?
No. Know the main letters: general purpose (M, T), compute (C), memory (R, X), storage (I, D), accelerated (P, G, Inf, Trn), and that "g" in names like m7g means Graviton.
6. Quick revision
- Stop keeps EBS data. Terminate deletes the root volume by default. Instance store data is lost on stop.
- gp3 gives 3,000 IOPS and 125 MiB/s baseline at any size.
- Snapshots are incremental and Regional. AMIs are Regional too; copy them to other Regions.
- ASG keeps desired capacity between min and max and replaces unhealthy instances.
- ALB is layer 7, NLB is layer 4, GWLB is for network appliances.
7. Related chapters
- Chapter 5: Amazon EC2 (Elastic Compute Cloud)
- Chapter 13: Amazon EBS (Elastic Block Store)
- AWS Elastic IP, AMI and EBS Snapshots Explained
- What Is Auto Scaling in AWS? Min, Max and Desired Explained
- Chapter 17: Scaling
- Chapter 18: Load Balancing
- How to Recover Data from a Broken EC2 Instance
- How to Add, Format and Mount an EBS Volume on EC2 (fstab)
This page is one part of a 500-question AWS interview set. Open the full list here: All 500 AWS interview questions.