Aws Compute¶
105 cards — 🟢 23 easy | 🟡 53 medium | 🔴 23 hard
🟢 Easy (23)¶
1. What is Amazon ECS and how does it orchestrate containers?
Show answer
[AWS Docs](https://aws.amazon.com/ecs): "Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service. Customers such as Duolingo, Samsung, GE, and Cook Pad use ECS to run their most sensitive and mission critical applications because of its security, reliability, and scalability."In simpler words, it allows you to launch containers on AWS.
While AWS takes care of starting/stopping containers, you need to provision and maintain the infrastructure where the containers are running (EC2 instances).
Remember: ECS = AWS-native container orchestration. Fargate = serverless ECS (no EC2 to manage). EC2 launch type = you manage the instances.
2. What is AWS EC2 and when would you use it?
Show answer
a web service that provides secure, resizable compute capacity in the cloud.Read more [here](https://aws.amazon.com/ec2)
Name origin: EC2 = Elastic Compute Cloud. 'Elastic' because capacity scales in minutes, not weeks.
Fun fact: EC2 launched August 2006 with one instance type (m1.small, 1.7GB RAM). Today there are 750+ types.
Name origin: EC2 = Elastic Compute Cloud. 'Elastic' because you can scale up/down on demand.
Remember: EC2 instance types follow the pattern: family + generation + size. Example: m5.xlarge = general purpose, 5th gen, extra large.
3. What is AWS Elastic Beanstalk?
Show answer
AWS definition: "AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services...You can simply upload your code and Elastic Beanstalk automatically handles the deployment"Learn more about it [here](https://aws.amazon.com/elasticbeanstalk)
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
4. Explain what is EC2 Nitro
Show answer
* Next generation EC2 instances using new virtualization technology* Better EBS: 64,000 EBS IOPS
* Better networking: HPC, IPv6
* Better security
Name origin: EC2 = Elastic Compute Cloud. 'Elastic' because you can scale up/down on demand.
Remember: EC2 instance types follow the pattern: family + generation + size. Example: m5.xlarge = general purpose, 5th gen, extra large.
5. What is AWS Lambda and when would you use serverless compute?
Show answer
AWS Lambda is a serverless compute service that runs your code in response to events (e.g., HTTP requests, file uploads) without you provisioning or managing servers. You upload your function code, and Lambda handles executing it on-demand and scaling automatically.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
6. What is an "EC2 Instance"?
Show answer
A virtual server running in the cloud.Under the hood: EC2 runs on the Nitro hypervisor (since 2017), which offloads networking, storage, and security to dedicated hardware for near-bare-metal performance.
Fun fact: the smallest current type (t4g.nano) has 2 vCPUs, 0.5GB RAM, and costs ~$3/month.
Name origin: EC2 = Elastic Compute Cloud. 'Elastic' because you can scale up/down on demand.
Remember: EC2 instance types follow the pattern: family + generation + size. Example: m5.xlarge = general purpose, 5th gen, extra large.
7. What is Simple Queue Service (SQS)?
Show answer
AWS definition: "Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications".Learn more about it [here](https://aws.amazon.com/sqs)
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
8. What is the difference between Launch Configuration and Launch Template?
Show answer
Launch configuration is a legacy form of Launch Template that must be recreated every time you would like to update the configuration.In addition, launch template has the clear benefits of:
* Provision both On-Demand and Spot instances
* supporting multiple versions
* support creating parameters subsets (used for reuse and inheritance)
Remember: launch templates replace launch configurations. They support versioning, can be updated, and work with ASG, EC2 Fleet, and Spot Fleet.
9. What is Amazon EC2 used for?
Show answer
Amazon Elastic Compute Cloud (EC2) provides scalable virtual servers in the cloud (compute instances) that you can launch on-demand to run applications. Essentially, EC2 offers resizable compute capacity (VMs) in AWS.Name origin: EC2 = Elastic Compute Cloud. 'Elastic' because you can scale up/down on demand.
Remember: EC2 instance types follow the pattern: family + generation + size. Example: m5.xlarge = general purpose, 5th gen, extra large.
10. What is a predictive scaling policy in regards to Auto Scaling Groups?
Show answer
Scale by analyzing historical load and schedule scaling based on forecast load.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
11. What is AWS Lightsail?
Show answer
AWS definition: "Lightsail is an easy-to-use cloud platform that offers you everything needed to build an application or website, plus a cost-effective, monthly plan."Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
12. What is Amazon ECR (Elastic Container Registry)?
Show answer
[AWS Docs](https://aws.amazon.com/ecr): "Amazon Elastic Container Registry (ECR) is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images."Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
13. Explain what is AWS Lambda
Show answer
AWS definition: "AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume."Read more on it [here](https://aws.amazon.com/lambda)
Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
14. What is the AWS Instance Connect?
Show answer
[AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Connect-using-EC2-Instance-Connect.html): "Amazon EC2 Instance Connect provides a simple and secure way to connect to your Linux instances using Secure Shell (SSH)."Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
15. What is AWS Fargate and how does it run containers without managing servers?
Show answer
[Amazon Docs](https://aws.amazon.com/fargate): "AWS Fargate is a serverless, pay-as-you-go compute engine that lets you focus on building applications without managing servers. AWS Fargate is compatible with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS)"In simpler words, AWS Fargate allows you launch containers on AWS without worrying about managing infrastructure. It runs containers based on the CPU and RAM you need.
Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
16. What is a launch template?
Show answer
[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html): "You can create a launch template that contains the configuration information to launch an instance. You can use launch templates to store launch parameters so that you do not have to specify them every time you launch an instance"Remember: launch templates replace launch configurations. They support versioning, can be updated, and work with ASG, EC2 Fleet, and Spot Fleet.
17. What is Amazon Web Services (AWS) and what are its core service categories?
Show answer
Amazon Web Services (AWS) is a collection of cloud computing services by Amazon, providing on-demand infrastructure and platforms (compute, storage, databases, networking, etc.) on a pay-as-you-go model.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
18. What is an "Auto Scaling Group"?
Show answer
Automatically adjusts EC2 instances to meet demand.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
19. What is "AWS Lambda"?
Show answer
A serverless compute service that runs code in response to events.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
20. What is an instance type?
Show answer
the instance type that you specify determines the hardware of the host computer used for your instanceRead more about instance types [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html)
Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
21. What is Simply Notification Service?
Show answer
AWS definition: "a highly available, durable, secure, fully managed pub/sub messaging service that enables you to decouple microservices, distributed systems, and serverless applications."Read more about it [here](https://aws.amazon.com/sns)
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
22. What is an AMI (Amazon Machine Image) in AWS?
Show answer
Amazon Machine Images is "An Amazon Machine Image (AMI) provides the information required to launch an instance".Read more [here](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html)
Remember: AMI = Amazon Machine Image. It's a snapshot of an EC2 instance: OS, software, config. Think 'golden image.'
23. What is dynamic Scaling policy in regards to Auto Scaling Groups?
Show answer
A policy in which scaling will occur automatically based on different metrics.There are 3 types:
1. Target Tracking Scaling: scale when the baseline changes (e.g. CPU is over 60%)
2. Step Scaling: more granular scaling where you can choose different actions for different metrics values (e.g. when CPU less than 20%, remove one instance. When CPU is over 40%, add 3 instances)
3. Scheduled Actions: set in advance scaling for specific period of time (e.g. add instances on Monday between 10:00 am to 11:00 am)
🟡 Medium (53)¶
1. Explain EC2 Capacity Reservations
Show answer
* Allows you to ensure you have EC2 capacity when you need it* Usually combined with Reserved Instances and Saving Plans to achieve cost saving
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
2. Explain EC2 Instance Store. Why would someone choose to use it over other options?
Show answer
EC2 instance store provides better I/O performances when compared to EBS.It is mostly used for cache and temporary data purposes.
Gotcha: instance store data is lost when the instance stops, terminates, or hibernates — physically attached to the host. Use EBS for persistence.
Under the hood: instance store uses NVMe SSDs on the hypervisor host, delivering hundreds of thousands of IOPS with sub-millisecond latency.
Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
3. What is Warmup and Cool down period ?
Show answer
* *Warm Up Time*: Duration for newly launched instances to stabilize before they receive full traffic.* *Cool Down Period*: Time during which Auto Scaling waits before another scaling activity.
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
4. Explain Auto Scaling Group
Show answer
[Amazon Docs](https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGroup.html): "An Auto Scaling group contains a collection of Amazon EC2 instances that are treated as a logical grouping for the purposes of automatic scaling and management. An Auto Scaling group also enables you to use Amazon EC2 Auto Scaling features such as health check replacements and scaling policies"Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
5. If you would like to have an hardware disk attached to your EC2 instead of a network one (EBS). What would you use?
Show answer
EC2 Instance Store.Gotcha: instance store data is lost when the instance stops, terminates, or hibernates — physically attached to the host. Use EBS for persistence.
Under the hood: instance store uses NVMe SSDs on the hypervisor host, delivering hundreds of thousands of IOPS with sub-millisecond latency.
Remember: EBS volume types: gp3 (general purpose, baseline 3000 IOPS), io2 (high IOPS, up to 64000), st1 (throughput HDD), sc1 (cold HDD). gp3 is the default choice for most workloads.
6. What one should do in order to make EC2 instance part of an ECS cluster?
Show answer
Install ECS agent on it. Some AMIs have built-in configuration for that.Under the hood: the ECS agent is a Go binary that registers the instance with the ECS control plane, pulls images, and manages task lifecycle.
Gotcha: Amazon Linux 2/2023 AMIs include the ECS agent. Other AMIs require manual install and configuration.
Remember: ECS = AWS-native container orchestration. Fargate = serverless ECS (no EC2 to manage). EC2 launch type = you manage the instances.
7. Which tool would you use for choosing between Reserved instances or On-Demand instances?
Show answer
AWS Cost Explorer — a built-in console tool that analyzes your historical spending patterns and usage data, then provides recommendations on whether Reserved Instances or Savings Plans would reduce costs compared to On-Demand pricing.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
8. What would you use for customizing EC2 instances? As in software installation, OS configuration, etc.
Show answer
AMI. With AMI (Amazon Machine Image) you can customize EC2 instances by specifying which software to install, what OS changes should be applied, etc.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
9. True or False? Reserved instance has to be used for a minimum of 1 year
Show answer
True. AWS Reserved Instances require a minimum 1-year commitment (1-year or 3-year terms) in exchange for significant discounts over On-Demand pricing.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
10. what are launch configuration and launch template and how do they differ from each other.
Show answer
Both are like instructions for creating computers (EC2 instances), but a launch configuration is an older set of rules, while a launch template is a newer, more flexible, and organized way of doing the same job but Launch Templates offer more features and flexibility compared to Launch Configurations.Remember: launch templates replace launch configurations. They support versioning, can be updated, and work with ASG, EC2 Fleet, and Spot Fleet.
11. What AWS services are serverless (or have the option to be serverless)?
Show answer
AWS LambdaAWS Athena
Remember: EC2 instance naming: family (m=general, c=compute, r=memory, t=burstable) + generation + size. Example: m6i.xlarge = 6th gen Intel general purpose.
Gotcha: always use the latest generation for better price-performance. m6i is cheaper AND faster than m5.
12. True or False? Region is a factor when it comes to EC2 costs/pricing
Show answer
True. You pay differently based on the chosen region.Example: m5.large costs ~$0.096/hr in us-east-1 but ~$0.112/hr in eu-west-1 — 17% more due to local power, real estate, and tax costs.
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
13. How have you handled golden images?
Show answer
I've worked with AWS Image Builder and Packer-style pipelines to generate pre-hardened AMIs. The workflow is usually: baseline OS → apply security hardening → install required packages → run validation tests → push to AMI catalog. This keeps patching consistent and eliminates drift.Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
14. True or False? AMI are built for specific region
Show answer
True (but they can be copied from one region to another).Under the hood: AMIs are stored in S3 within a region. Cross-region copies create a new AMI ID and can take minutes to hours depending on size.
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
15. From networking perspective, what do you get by default when running an EC2 instance?
Show answer
A private IP and a public IP.Gotcha: the public IP changes on stop/start. Use an Elastic IP (EIP) for a static public address that persists.
Under the hood: the public IP is invisible inside the instance (ip addr shows only private IP). AWS NATs at the Internet Gateway.
Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
16. If you use ASG and you would like to run extra steps before the instance goes in service, what will you use?
Show answer
Lifecycle hooks in pending state.Under the hood: hooks pause the instance in Pending:Wait, allowing scripts (via SNS/SQS) for config pulls, service registration, or smoke tests before joining the load balancer.
Gotcha: if the hook does not send CONTINUE within the timeout (default 3600s), the instance is terminated or abandoned.
Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
17. True or False? The following are instance types available for a user in AWS:
Show answer
False. From the above list only compute optimized is available.Remember: EC2 families — General (M/T), Compute (C), Memory (R/X), Storage (I/D), Accelerated (P/G/Inf). Mnemonic: 'Many Tasks Compute, Requiring eXtra IO, Delivering Parallel GPU work.'
Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
18. Explain the difference between AWS ECS and AWS EKS.
Show answer
* ECS (Elastic Container Service): It's a container management service for Docker containers, offering simplicity and native integration with other AWS services.* EKS (Elastic Kubernetes Service): It's a managed Kubernetes service offering open-source flexibility and scalability with less AWS-specific functionality.
Remember: EKS = managed Kubernetes control plane. AWS handles etcd, API server, scheduler. You manage worker nodes (or use Fargate for serverless pods).
19. What bootstrapping means and how to use it in AWS EC2?
Show answer
Bootstrapping is about launching commands when a machine starts for the first time.In AWS EC2 this is done using the EC2 user data script.
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
20. Which service would you use for building a website or web application?
Show answer
Amazon Lightsail. It bundles a VPS with compute, storage, DNS, and a static IP into a single low-cost plan — ideal for simple sites without full EC2 complexity.Remember: EBS volume types: gp3 (general purpose, baseline 3000 IOPS), io2 (high IOPS, up to 64000), st1 (throughput HDD), sc1 (cold HDD). gp3 is the default choice for most workloads.
21. Which pricing model has potentially the biggest discount and what its advantage
Show answer
Spot instances provide the biggest discount but has the disadvantage of risking losing them due bigger bid price.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
22. Explain the benefits of using AWS Elastic Beanstalk.
Show answer
Elastic Beanstalk: It's a service that simplifies deployment and management of applications in the AWS cloud.Benefits: It streamlines infrastructure management, eases deployment, and allows developers to focus on coding. projects/knowledge/interview/aws/444-explain-the-benefits-of-using-aws-elastic-beanstal.txt
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
23. You would like to invoke a function every time you enter a URL in the browser. Which service would you use for that?
Show answer
AWS Lambda. It runs code in response to events (including API Gateway HTTP triggers) with no servers to manage. You pay only for execution time.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
24. You need an instance for short-term and the workload running on instance must not be interrupted. Which pricing model would you use?
Show answer
On Demand is good for short-term non-interrupted workloads (but it also has the highest cost).Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
25. What are some of the differences between dedicated hosts and dedicated instances?
Show answer
In dedicated hosts you have per host billing, you have more visibility (sockets, cores, ...) and you can control where instance will be placed.In dedicated instances the billing is per instance but you can't control placement and you don't have visibility of sockets, cores, ...
Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
26. True or False? Using EC2 hibernate option results in having faster instance boot
Show answer
True. This is because the operating system isn't restarted or stopped.Remember: EC2 instance naming: family (m=general, c=compute, r=memory, t=burstable) + generation + size. Example: m6i.xlarge = 6th gen Intel general purpose.
Gotcha: always use the latest generation for better price-performance. m6i is cheaper AND faster than m5.
27. What is an AMI in context with Ec2 instance ?
Show answer
Think of an AMI as a pre-set computer setup you can use to create new computers (EC2 instances). It's like a special recipe for a computer, including the operating system, software, and settings. It can be referred as an Image ISO of the operating system to be installed, It's a pre-configured template used to create EC2 instances. It includes the operating system, application server, and applications.Name origin: EC2 = Elastic Compute Cloud. 'Elastic' because you can scale up/down on demand.
Remember: EC2 instance types follow the pattern: family + generation + size. Example: m5.xlarge = general purpose, 5th gen, extra large.
28. What ECS launch types are there?
Show answer
* EC2 Instance* AWS Fargate
Remember: ECS = AWS-native container orchestration. Fargate = serverless ECS (no EC2 to manage). EC2 launch type = you manage the instances.
29. True or False? In EC2 On Demand, you pay per hour when using Linux or Windows and per second (after first minute) when using any other operating system
Show answer
False. You pay per second (after the first minute) when using Windows or Linux and per hour for any other OS.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
30. Explain Lifecycle hooks in regards to Auto Scaling Groups
Show answer
Lifecycle hooks allows you perform extra steps before the instance goes in service (During pending state) or before it terminates (during terminating state).Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
31. Explain the instance type naming convention
Show answer
Let's take for example the following instance type: m5.large`m` is the instance class
`5` is the generation
`large` is the size of the instance (affects the spec properties like vCPUs and RAM)
Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
32. What are the different sources for AMIs?
Show answer
* Personal AMIs - AMIs you create* AWS Marketplace for AMIs - AMIs made by others, mostly sold for some price
* Public AMIs - Provided by AWS
Remember: AMI = Amazon Machine Image. It's a snapshot of an EC2 instance: OS, software, config. Think 'golden image.'
33. Explain the difference between EC2 and Lambda in AWS.
Expected Answer: EC2 provides virtual servers that you manage, while Lambda allows serverless execution of code without server provisioning.
Show answer
EC2 Instance: It's a virtual server in the cloud where you can run applications. Think of it as a computer system hosted in AWS.AMI (Amazon Machine Image): It's a template that provides the information needed to launch an EC2 instance. An AMI includes the operating system, application server, and applications. While an EC2 instance is like a running computer, an AMI is like a blueprint or image of that computer.
Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
34. What CPU customization is available with EC2?
Show answer
* Modifying number of CPU cores (useful for high RAM and low CPU applications)* Modifying number of threads per cure (useful for HPC workloads)
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
35. What is AWS Lambda Layers?
Show answer
Lambda Layers: These allow you to centrally manage common code and data shared across multiple Lambda functions. Layers are useful for shared libraries, custom runtimes, and dependencies.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
36. What EC2 pricing models are there?
Show answer
On Demand - pay a fixed rate by the hour/second with no commitment. You can provision and terminate it at any given time.Reserved - you get capacity reservation, basically purchase an instance for a fixed time of period. The longer, the cheaper.
Spot - Enables you to bid whatever price you want for instances or pay the spot price.
Dedicated Hosts - physical EC2 server dedicated for your use.
Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
37. What are Spot Instances in AWS EC2?
Show answer
Spot Instances are spare EC2 capacity offered at up to 90% discount in exchange for the caveat that AWS can reclaim (terminate) them with a 2-minute notice if needed. They are great for fault-tolerant, flexible workloads that can handle interruptions.Remember: Spot = up to 90% cheaper but can be reclaimed with 2-minute warning. Great for batch jobs, CI/CD runners, and stateless workers.
Gotcha: spot instances get a 2-minute termination notice via instance metadata. Your app must handle graceful shutdown.
38. Can you tell me bunch of ec2 instance types ?
Show answer
EC2 instances come in various sizes and capabilities, just like different cars have different features. There are types for general tasks, memory-intensive work, or high-performance computing, each suited for specific jobs. Some of these would be t2, t3, m4, m5, c5 etc.Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
39. You need an instance for running an application for a period of 2 years continuously, without changing instance type. Which pricing model would you use?
Show answer
Reserved instances: they are cheaper than on-demand and the instance is yours for the chosen period of time.Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
40. Describe AWS Lambda and its use cases.
Show answer
AWS Lambda: It's a serverless computing service that runs code in response to events and automatically manages resources. It's ideal for executing small, event-driven functions, making it perfect for tasks like data processing, file handling, and automation.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
41. Explain the following types of reserved instances:
Show answer
* Convertible Reserved Instances: used for long running workloads but used when instance type might change during the period of time it's reserved* Scheduled Reserved Instances: when you need to reserve an instance for a long period but you don't need it continuously (so for example you need it only in the morning)
Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
42. Explain each of the following instance types:
Show answer
Compute Optimized:* Used for compute-intensive tasks
* It has high performance processors
* Use cases vary: gaming serves, machine learning, batch processing, etc.
Memory Optimized:
* Used for processing large data sets in memory
* Other use cases: high performance, databases, distributed cache stores
Storage Optimized:
* Used for storage intensive tasks - high read and write access to large data sets
* Use cases: databases, OLTP system, distributing file systems
Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
43. What are Auto Scaling Groups and how do they work in AWS?
Show answer
Auto Scaling Groups: They automatically adjust the number of instances in response to changing demand. They maintain the desired number of instances even if one fails and can dynamically scale based on rules or policies.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
44. What are some use cases for using EC2 hibernate option?
Show answer
* Save RAM state* Service with long time initialization
* Keep long-running processes
Remember: EC2 instance naming: family (m=general, c=compute, r=memory, t=burstable) + generation + size. Example: m6i.xlarge = 6th gen Intel general purpose.
Gotcha: always use the latest generation for better price-performance. m6i is cheaper AND faster than m5.
45. What is an Auto Scaling Group (ASG)?
Show answer
An Auto Scaling Group is a group of EC2 instances managed together for scaling and availability. You define conditions or schedules for scaling (adding or removing instances) based on load (CPU, etc.), and the ASG will launch or terminate EC2 instances to maintain the desired capacity or to react to demand spikes.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
46. For how long can reserved instances be reserved?
Show answer
1 year or 3 years. Reserved Instances offer significant discounts (up to 72%) over On-Demand pricing in exchange for a commitment to a specific instance type, region, and term length. Longer terms yield deeper discounts.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
47. What EC2 reserved instance types are there?
Show answer
Standard RI - most significant discount + suited for steady-state usageConvertible RI - discount + change attribute of RI + suited for steady-state usage
Scheduled RI - launch within time windows you reserve
Learn more about EC2 RI [here](https://aws.amazon.com/ec2/pricing/reserved-instances)
Remember: MCRT — M (general), C (compute), R (memory/RAM), T (burstable). Think 'My Computers Run Tasks.'
48. You need an instance for running workloads. You don't care if they fail for a given moment as long as they run eventually. Which pricing model would you use?
Show answer
Spot instances. The discount potential is the highest compared to all other pricing models. The disadvantage is that you can lose the instance at any point so, you must run only workloads that you are fine with them failing suddenly.Gotcha: check the instance type's network bandwidth, EBS bandwidth, and vCPU-to-memory ratio before choosing. The cheapest instance isn't always the most cost-effective.
49. Which of the following set of languages Lambda supports?
Show answer
- Python, Ruby, Go, Node.js, PowerShell, C#Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
50. What are "Placement Groups"?
Show answer
[AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html): "When you launch a new EC2 instance, the EC2 service attempts to place the instance in such a way that all of your instances are spread out across underlying hardware to minimize correlated failures. You can use placement groups to influence the placement of a group of interdependent instances to meet the needs of your workload."Remember: Cluster = low latency (same rack). Spread = high availability (different racks). Partition = large distributed workloads (separate failure domains).
51. True or False? "Consumers" can be only EC2 instances
Show answer
False. They can be Lambda functions and even on-premise instancesRemember: EC2 instance naming: family (m=general, c=compute, r=memory, t=burstable) + generation + size. Example: m6i.xlarge = 6th gen Intel general purpose.
Gotcha: always use the latest generation for better price-performance. m6i is cheaper AND faster than m5.
52. What Placement Groups strategies are there?
Show answer
* Cluster: places instance close together in an AZ.* Spread: spreads the instance across the hardware
* Partition: spreads the instances across different partitions (= different sets of hardware/racks) within an AZ
Remember: Cluster = low latency (same rack). Spread = high availability (different racks). Partition = large distributed workloads (separate failure domains).
53. True or False? In AWS Lambda, you are charged as long as a function exists, regardless of whether it's running or not
Show answer
False. Charges are being made when the function is executed for the time it takes to execute and compute resources it uses.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
🔴 Hard (23)¶
1. True or False? Cancelling a Spot instance request terminates the instance
Show answer
False. When you cancel a Spot instance request, you are not terminating the instances created by it.To terminate such instances, you must cancel the Spot instance request first.
Remember: Spot = up to 90% cheaper but can be reclaimed with 2-minute warning. Great for batch jobs, CI/CD runners, and stateless workers.
Gotcha: spot instances get a 2-minute termination notice via instance metadata. Your app must handle graceful shutdown.
2. What are Spot Fleets?
Show answer
Set of Spot instances and if you would like, also on-demand instances.Under the hood: Spot Fleet maintains target capacity by automatically replacing interrupted instances from your specified launch specs.
Gotcha: diversify across multiple instance types and AZs to reduce interruption probability.
Remember: Spot = up to 90% cheaper but can be reclaimed with 2-minute warning. Great for batch jobs, CI/CD runners, and stateless workers.
Gotcha: spot instances get a 2-minute termination notice via instance metadata. Your app must handle graceful shutdown.
3. You need an instance for two years, but only between 10:00-15:00 every day. Which pricing model would you use?
Show answer
Reserved instances from the "Scheduled Reserved Instances" type which allows you to reserve for specific time window (like 10:00-15:00 every day).Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
4. What are the cons and pros of the "Spread" placement group strategy?
Show answer
Cons:* Current limitation is 7 instances per AZ (per replacement group)
Pros:
* Maximized high availability (instances on different hardware, span across AZs)
Remember: Cluster = low latency (same rack). Spread = high availability (different racks). Partition = large distributed workloads (separate failure domains).
5. What strategies are there to allocate Spot instances?
Show answer
* lowestPrice: launch instances from the pool that has the lowest price* diversified: distributed across all pools
* capacityOptimized: optimized based on the number of instances
Remember: Spot = up to 90% cheaper but can be reclaimed with 2-minute warning. Great for batch jobs, CI/CD runners, and stateless workers.
Gotcha: spot instances get a 2-minute termination notice via instance metadata. Your app must handle graceful shutdown.
6. You need a persistent shared storage between your containers that some are running in Fargate and some in ECS. What would you use?
Show answer
EFS. It allows us to have persistent multi-AZ shared storage for containers.Under the hood: EFS is managed NFS v4.1 — auto-scaling, per-GB billing, no pre-provisioning. Mount targets needed in each AZ.
Gotcha: EFS burst throughput is very low for small filesystems (50KB/s per GB stored). Use provisioned throughput for production.
Remember: ECS = AWS-native container orchestration. Fargate = serverless ECS (no EC2 to manage). EC2 launch type = you manage the instances.
7. How AWS Fargate different from AWS ECS?
Show answer
In AWS ECS, you manage the infrastructure - you need to provision and configure the EC2 instances.While in AWS Fargate, you don't provision or manage the infrastructure, you simply focus on launching Docker containers. You can think of it as the serverless version of AWS ECS.
Remember: ECS = AWS-native container orchestration. Fargate = serverless ECS (no EC2 to manage). EC2 launch type = you manage the instances.
8. You need a physical server only for your use. Which pricing model are you going to use?
Show answer
EC2 Dedicated HostUnder the hood: Dedicated Hosts give socket and core visibility for license compliance (per-core Oracle, Windows Server, SQL Server).
Gotcha: most expensive EC2 option. Use Dedicated Instances if you only need hardware isolation without socket/core visibility.
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
9. True or False? by default, ASG tries to balance the number of instances across AZ
Show answer
True, this is why when it terminates instances, it chooses the AZ with the most instances.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
10. What can you tell me about warm pool ?
Show answer
A feature in EC2 Auto Scaling Groups that allows pre-provisioning instances to respond to sudden traffic spikes.Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
11. Describe one way to test ASG actually works
Show answer
In Linux instances, you can install the 'stress' package and run stress to load the system for certain period of time and see if ASG kicks in by adding additional capacity (= more instances).For example: `sudo stress --cpu 100 --timeout 20`
Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
12. Explain scaling cooldowns in regards to Auto Scaling Groups
Show answer
During a scaling cooldown, ASG will not terminate or launch additional instances. The cooldown happens after scaling activity and the reason for this behaviour is that some metrics have to be collected and stabilize before another scaling operating can take place.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
13. What happens to the EC2 disk (EBS) when the instance is stopped?
Show answer
Disk is intact and can be used when the instance starts.Gotcha: applies to EBS-backed instances only. Instance store volumes are wiped on stop. You still pay for the EBS volume while the instance is stopped.
Remember: EBS volume types: gp3 (general purpose, baseline 3000 IOPS), io2 (high IOPS, up to 64000), st1 (throughput HDD), sc1 (cold HDD). gp3 is the default choice for most workloads.
14. What's the difference between Restart and Start/Stop of an ec2-instance ?
Show answer
Restart: Quickly halts and restarts the instance.Start/Stop: Completely halts the instance, which persists even after a start command. The VM is launched on a different host machine.
Remember: right-sizing is the #1 cost optimization. Use AWS Compute Optimizer to identify over-provisioned instances. Most workloads use less than 40% of their allocated CPU.
15. What are the cons and pros of the "Cluster" placement group strategy?
Show answer
Cons: if the hardware fails, all instances failPros: Low latency & high throughput network
Remember: Cluster = low latency (same rack). Spread = high availability (different racks). Partition = large distributed workloads (separate failure domains).
16. Explain the default ASG termination policy
Show answer
1. It finds the AZ which the most number of EC2 instances2. If number of instances > 1, choose the one with oldest launch configuration, template and terminate it
Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
17. What are different frameworks of Lambda, why do we even require them ?
Show answer
Lambda is like a team of workers you can hire to do specific jobs whenever you need. Frameworks give these workers different skills for various tasks, allowing them to handle different types of jobs efficiently. Examples include Serverless Framework, SAM (Serverless Application Model), and Chalice. They streamline Lambda deployments.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
18. What is the maximum execution time for a Lambda function?
Show answer
15 minutes (900 seconds). This is the maximum execution timeout for a single AWS Lambda invocation. For longer-running workloads, consider Step Functions, ECS/Fargate tasks, or breaking the work into chained Lambda calls.Remember: Lambda = serverless functions. Pay per invocation + duration. Max 15 minutes runtime, 10 GB memory, 512 MB /tmp storage.
19. How to share data between containers (some from ECS and some from Fargate)?
Show answer
Using EFS is a good way to share data between containers and it works also between different AZs.Remember: ECS = AWS-native container orchestration. Fargate = serverless ECS (no EC2 to manage). EC2 launch type = you manage the instances.
20. For each of the following scenarios choose a placement group strategy:
Show answer
* High availability is top priority - Spread* Low latency between instances - Cluster
* Instances must be isolated from each other - Spread
* Big Data applications that are partition aware - Partition
* Big Data process that needs to end quickly - Cluster
Remember: Cluster = low latency (same rack). Spread = high availability (different racks). Partition = large distributed workloads (separate failure domains).
21. You have two instance running as part of ASG. You change the desired capacity to 1. What will be the outcome of this change?
Show answer
One of the instances will be terminated.Remember: ASG = min + desired + max capacity. CloudWatch alarms trigger scaling policies. Desired adjusts between min and max.
22. Are there any disadvantages in using instance store over EBS?
Show answer
Yes, the data on instance store is lost when they are stopped.Remember: EBS volume types: gp3 (general purpose, baseline 3000 IOPS), io2 (high IOPS, up to 64000), st1 (throughput HDD), sc1 (cold HDD). gp3 is the default choice for most workloads.
23. When you launch EC2 instances, it takes them time to boot due to commands you run with user data. How to improve instances boot time?
Show answer
Consider creating customized AMI with the commands from user data already executed there. This will allow you launch instance instantly.Gotcha: user data runs only on first boot (unless you configure cloud-init for every boot). It's base64-encoded and limited to 16 KB.