Compute Services
In this chapter you will learn how Amazon EC2 works (AMIs, instance types and families, Graviton processors, EBS-backed instances, user data, and key pairs); how Amazon EC2 Auto Scaling and Elastic Load Balancing work together to make applications elastic and highly available; how AWS Lambda runs code in response to events and how it is priced; how AWS runs containers with Amazon ECS, Amazon EKS, AWS Fargate, and Amazon ECR; where AWS App Runner, Amazon Lightsail, and AWS Batch fit; and how to choose the right compute option for a scenario. This chapter maps to Domain 3, Cloud Technology and Services, Task Statement 3.3 (identify AWS compute services).
9.1 The compute spectrum
“Compute” simply means the processing power that runs your code. AWS offers many compute services, and at first the list can feel overwhelming. The trick is to see them as points on a spectrum of control versus convenience. At one end is Amazon EC2, where you get a virtual server and control almost everything: the operating system, patches, installed software, and scaling. At the other end is AWS Lambda, where you upload a function and AWS handles servers, operating systems, and scaling entirely; you only think about your code. Containers sit in between: you package your application and its dependencies into an image, and an orchestrator runs it, either on EC2 instances you manage or on serverless capacity with AWS Fargate.
As you move toward the convenient end, AWS takes on more of the shared responsibility model. With EC2, patching the guest operating system is your job. With Lambda and Fargate, it is AWS’s job. Exam questions that mention “least operational overhead” or “no servers to manage” are steering you toward the convenient end of this spectrum.
9.2 Amazon EC2 fundamentals
Amazon Elastic Compute Cloud (EC2) provides resizable virtual servers called instances. You can launch one in minutes, pay only while it runs, and terminate it when you are done. EC2 is the foundation of a large part of AWS; many other services run on it behind the scenes.
To launch an instance, you make a handful of decisions. The EC2 launch wizard walks you through them in order. Console EC2 > Instances > Launch an instance Region: Ireland
dnf install -y httpd ...
Summary
Number of instances
Figure 9.1: The EC2 launch-instance wizard gathers the key choices on one page: name, AMI, instance type, key pair, network settings, storage,
and advanced details such as user data. (Illustration, not an actual AWS screenshot.)
Amazon Machine Images (AMIs)
An Amazon Machine Image (AMI) is the template for an instance’s root volume. It contains the operating system and any preinstalled software and configuration. You can choose:
AWS-provided AMIs, such as Amazon Linux, Ubuntu, Red Hat Enterprise Linux, or Windows Server.
AWS Marketplace AMIs, published by software vendors with their product preinstalled (sometimes with a software charge added to the hourly price).
Community AMIs shared by other users (use with care).
Your own custom AMIs, created from an instance you have configured. A custom “golden image” lets you launch new, identical servers quickly.
AMIs are regional. To use an AMI in another Region, you copy it there.
Instance types and families
The instance type decides how much CPU, memory, storage, and networking capacity an instance has. Instance types are grouped into families optimized for different kinds of work.
Family Optimized for Typical uses
General purpose (M, T) Balance of CPU, memory, network Web servers, small databases, dev/test Compute optimized (C) High-performance processors Batch processing, gaming servers, HPC, encoding
Memory optimized (R, X) Largeamounts of RAM In-memory databasesand caches, real-timeanalytics Accelerated computing (P, G, Inf, Trn) GPUs or AI chips Machine learning, graphics rendering Storage optimized (I, D) Fast, large local storage High-I/O databases, data warehousing The T family is “burstable”: instances earn CPU credits while idle and spend them during short bursts of activity, which makes them inexpensive for workloads that are usually quiet.
Instance type names follow a pattern. In m7g.xlarge , m is the family, 7 is the generation, g is an attribute (here, a Graviton processor), and xlarge is the size. Sizes double as you go up: large , xlarge , 2xlarge , 4xlarge , and so on. Changing an instance’s size up or down is called vertical scaling.
Figure 9.2: EC2 instance families and how to read an instance type name. Choose the family by the resource your workload needs most, then choose a size.
Exam tip
Match the keyword to the family. “In-memory database” or “large datasets in memory” means memory optimized. “High-performance computing,” “scientific modeling,” or “video encoding” means compute optimized. “Machine learning training” or “graphics” means accelerated computing. “High sequential read/write to local storage” means storage optimized. “Balanced” or “variety of workloads” means general purpose.
AWS Graviton processors
AWS Graviton processors are ARM-based CPUs designed by AWS. Instance types with a g in the attribute position (such as m7g , c8g , r8g ) use Graviton. AWS positions Graviton as offering better price-performance and lower energy use than comparable x86 instances for many workloads, so it is a common answer for questions about reducing cost or improving the sustainability of compute. The catch is that software must be compiled for ARM; most Linux software, interpreted languages, and containers built for multiple architectures work well.
Storage for instances: EBS-backed versus instance store
Most instances today are EBS-backed: the root volume is an Amazon EBS volume, a network-attached disk that persists independently of the instance. You can stop an EBS-backed instance (you stop paying for compute but keep paying for the EBS storage) and start it again later with its data intact. Some instance types also offer instance store volumes, which are disks physically attached to the host. They are very fast but ephemeral: data is lost when the instance stops, hibernates, or terminates, or if the underlying hardware fails. Chapter 10 covers both in detail.
User data
User data is a script you provide at launch that runs automatically when the instance first boots. It is commonly used to install updates, install a web server, or download application code, so that an instance is ready to serve traffic without anyone logging in. By default it runs only on the first boot.
Key pairs and connecting to instances
A key pair is a public key that AWS places on the instance and a private key that you download once and keep safe. For Linux instances, you use the private key to connect with SSH. For Windows instances, you use it to decrypt the initial administrator password for Remote Desktop. AWS does not keep a copy of your private key, so if you lose it, you cannot recover it.
Modern alternatives reduce the need to manage keys at all. EC2 Instance Connect pushes a short-lived key for a browser-based or SSH session, and AWS Systems Manager Session Manager gives shell access through the console without opening inbound ports or using SSH keys.
Security groups (a quick reminder)
Every instance has one or more security groups, which act as stateful virtual firewalls controlling inbound and outbound traffic. For example, a web server’s security group might allow inbound HTTPS (port 443) from anywhere and SSH (port 22) only from your office IP range. Security groups are covered in depth in the networking and security chapters (Chapters 12 and 7).
Hands-on lab
Hands-on mini lab: launch a web server with user data
- 1. In the console, open the EC2 service and confirm the Region in the top bar.
- 2. Choose Launch instance. Enter the name lab-web .
- 3. Under Application and OS Images, choose an Amazon Linux AMI.
- 4. Under Instance type, choose a small, free-plan-eligible type (look for the label in the list).
- 5. Under Key pair, choose Proceed without a key pair (we will not log in).
- 6. Under Network settings, allow HTTP traffic from the internet.
- 7. Expand Advanced details and paste this into User data: #!/bin/bash on the first line, then dnf install -y httpd , systemctl enable --now httpd , and echo "Hello from EC2" > /var/www/html/index.html on separate lines.
- 8. Choose Launch instance. When the instance state is Running and status checks pass, copy its public IPv4 address into a browser using http:// .
- 9. When finished, select the instance and choose Instance state > Terminate to stop charges.
Paying for EC2 (in brief)
EC2 can be bought in several ways: On-Demand (pay by the second, no commitment), Savings Plans and Reserved Instances (commit to usage for one or three years for a large discount), Spot Instances (use spare capacity at a deep discount, but AWS can reclaim it with a two-minute warning), and Dedicated Hosts or Dedicated Instances (hardware dedicated to you, for licensing or compliance). These options are covered fully in the billing and pricing domain in Chapter 15; for now, remember that Spot suits flexible, interruption-tolerant work and Savings Plans suit steady usage.
9.3 Amazon EC2 Auto Scaling
Traffic is rarely flat. An online store is busy at lunchtime and on holidays and quiet at 3 a.m. With fixed capacity, you either pay for idle servers or run out of capacity at peak. Amazon EC2 Auto Scaling fixes this by adding and removing instances automatically. This is horizontal scaling: adding more instances rather than making one bigger. You create an Auto Scaling group with three numbers:
Minimum capacity: the group never shrinks below this. Setting it to 2 across two AZs guarantees a baseline of availability.
Desired capacity: how many instances the group should run right now.
Maximum capacity: a ceiling that protects your budget.
The group uses a launch template (AMI, instance type, security groups, user data, and so on) to create new instances that are all configured the same way.
Auto Scaling does two jobs:
- 1. Health replacement (fleet management). If an instance fails a health check, the group terminates it and launches a replacement. Even a group with min, desired, and max all set to 1 is useful for this self-healing.
- 2. Scaling. The group changes desired capacity based on policies:
Target tracking, such as “keep average CPU at 50%.” This
is the simplest and most common.
Step or simple scaling, which reacts to CloudWatch
alarms with fixed adjustments.
- Scheduled scaling, such as “run 10 instances every
- weekday from 8 a.m.”
- Predictive scaling, which uses machine learning on past
traffic to scale ahead of expected demand.
Auto Scaling directly delivers the cloud benefit of elasticity: capacity follows demand, and you stop paying for what you do not need.
9.4 Elastic Load Balancing
If Auto Scaling keeps changing the number of instances, how do users find them? Elastic Load Balancing (ELB) provides a single entry point (a DNS name) that spreads incoming traffic across healthy targets, such as EC2 instances, containers, IP addresses, or Lambda functions, in multiple AZs. It performs health checks and stops sending traffic to unhealthy targets. ELB itself is a managed, highly available service that scales automatically.
There are three current types:
Type Layer Choose it when
Application Load Balancer (ALB) 7 (HTTP/HTTPS) Web apps; routing by URL path or host name
Network Load Balancer (NLB) 4 (TCP/UDP/TLS) Extreme performance, very low latency, static IPs Gateway Load Balancer (GWLB) 3 (IP packets) Deploying third-party virtual appliances such as firewalls An ALB understands HTTP, so it can send /images/* to one group of servers and /api/* to another, or route shop.example.com and blog.example.com differently. An NLB works at the connection level and handles millions of requests per second with very low latency, which suits gaming, IoT, and non-HTTP protocols. A GWLB lets you insert a fleet of security or inspection appliances transparently into your network traffic. (An older Classic Load Balancer exists for legacy applications; new designs should not use it.)
ELB and Auto Scaling are a classic pair. When the Auto Scaling group launches a new instance, it registers it with the load balancer’s target group; when it terminates one, it deregisters it. Together they give you an application that is both elastic and highly available.
ELB: one DNS name, health checks, spreads requests across AZs.
Auto Scaling: replaces unhealthy instances and scales out and in.
Figure 9.3: A classic highly available web tier. An Application Load Balancer spreads requests across EC2 instances in two Availability Zones,
and an Auto Scaling group keeps the right number of healthy instances running.
Common trap
Elastic Load Balancing distributes traffic; it does not add capacity. EC2 Auto Scaling adds and removes instances; it does not spread traffic. Questions about “handling unpredictable spikes” usually want Auto Scaling (often with ELB). Questions about “distributing traffic across instances in multiple AZs” want ELB.
9.5 AWS Lambda
AWS Lambda runs your code without you provisioning or managing any servers. You upload a function (in languages such as Python, Node.js, Java, .NET, Go, or Ruby, or as a container image), and Lambda runs it whenever it is triggered. If 1,000 events arrive at once, Lambda runs many copies in parallel; if none arrive, nothing runs and you pay nothing for compute. This is the essence of serverless: no servers to manage, automatic scaling, built-in availability, and paying only for value delivered.
Event-driven by design
A Lambda function is invoked by an event. Common event sources include:
An object uploaded to an Amazon S3 bucket.
An HTTP request through Amazon API Gateway or a Lambda function URL.
A message in an Amazon SQS queue or a notification from Amazon SNS.
A change in an Amazon DynamoDB table (via DynamoDB Streams).
A schedule or rule in Amazon EventBridge (for example, “every night at 2 a.m.”).
- 1. Object is uploaded to the bucket.
- 2. S3 emits an event that invokes the function (no server waiting).
- 3. Function writes results, then stops. Billed per request and per ms of run time.
Figure 9.4: An event-driven flow. Uploading an image to Amazon S3 triggers a Lambda function that creates a thumbnail and records metadata in Amazon DynamoDB. No servers are running between events.
Limits worth knowing
Lambda is designed for short tasks. The headline limits are:
Maximum run time of 15 minutes per invocation.
Memory from 128 MB to 10,240 MB (10 GB). CPU power is allocated in proportion to memory.
Temporary storage in /tmp that is configurable up to 10 GB and does not persist between invocations. Jobs that need to run for hours, need specialized hardware, or need a persistent server are better on EC2, containers, or AWS Batch.
Lambda pricing
You pay for two things: the number of requests and the duration of each run, measured in milliseconds and weighted by the memory you allocated (expressed as GB-seconds). There is no charge when your code is not running. Lambda also has an Always Free allowance of 1 million requests and 400,000 GB-seconds of compute per month, which covers a lot of small projects.
Exam tip
“Run code in response to events,” “no servers to provision or manage,” and “pay only for compute time consumed” describe Lambda. If the task takes longer than 15 minutes, Lambda is the wrong answer.
9.6 Containers on AWS
A container packages an application with everything it needs (code, runtime, libraries, settings) into a single image that runs the same way on a laptop, a test server, or in production. Containers start in seconds, use resources efficiently, and are a natural fit for microservices, where an application is split into small, independently deployable services. Running a handful of containers is easy; running hundreds across many servers, restarting failed ones, and rolling out new versions requires an orchestrator. AWS offers four building blocks.
Amazon ECR: storing images
Amazon Elastic Container Registry (ECR) is a managed, private registry for container images. You push images to ECR, and ECS, EKS, Lambda, and other services pull them from it. ECR can scan images for software vulnerabilities.
Amazon ECS: AWS-native orchestration
Amazon Elastic Container Service (ECS) is AWS’s own fully managed container orchestrator. You describe your container in a task definition and run it as a long-running service or a one-off task. ECS integrates closely with load balancers, IAM, and CloudWatch and is generally considered the simpler choice when you do not specifically need Kubernetes.
Amazon EKS: managed Kubernetes
Amazon Elastic Kubernetes Service (EKS) runs the open-source Kubernetes orchestrator for you. AWS manages the Kubernetes control plane across multiple AZs. EKS is the answer when a company already uses Kubernetes, wants to use Kubernetes tooling, or wants to run the same platform on premises and in AWS (EKS can also run on Outposts and in your own data center with EKS Anywhere).
AWS Fargate: serverless compute for containers
Both ECS and EKS need somewhere to run containers. You have two choices:
EC2 launch type / EC2 nodes: containers run on EC2 instances in your account. You choose instance types, patch the OS, and scale the cluster. You get more control and can use Spot or Savings Plans on the instances. AWS Fargate: a serverless compute engine. You specify CPU and memory per task or pod, and AWS runs it without you seeing or managing any servers. You pay for the vCPU and memory your containers request while they run. Running containers on AWS: three layers
- 1. Image
registry
- 2. Orchestrator
schedules, heals
- 3. Compute
Either orchestrator can use either compute option.
Figure 9.5: Container building blocks. ECR stores images; ECS or EKS orchestrates them; the containers run either on EC2 instances you manage or on serverless AWS Fargate capacity.
Common trap
Fargate is not an orchestrator and is not an alternative to ECS or EKS. It is a way to run ECS tasks or EKS pods without managing servers. “Run containers without managing servers or clusters” means Fargate (with ECS or EKS). “Managed Kubernetes” means EKS. “Store container images” means ECR.
9.7 Simpler and specialized compute options
AWS App Runner
AWS App Runner is a fully managed service for running web applications and APIs directly from source code or a container image. You point it at a repository or an ECR image, and it builds, deploys, load-balances, scales, and secures the service with HTTPS, with no clusters or load balancers to configure. It is aimed at developers who want the simplest path from code to a running web service. As with any service, check the current AWS documentation for regional and new-customer availability.
Amazon Lightsail
Amazon Lightsail offers simple virtual private servers, managed databases, load balancers, and container services at a predictable, low monthly price bundled with storage and data transfer. It suits small websites, blogs (such as WordPress), simple web apps, and users who are new to the cloud and do not want to learn EC2, VPC, and EBS separately. If a question stresses “simple,” “predictable monthly pricing,” or “limited cloud experience,” think Lightsail.
AWS Batch
AWS Batch runs batch computing jobs at any scale. You submit jobs to a queue, and Batch provisions the right amount and type of compute (EC2, Spot, or Fargate), runs the jobs, and scales back down. It fits large numbers of independent jobs such as financial risk modeling, genomics, media transcoding, and simulations. Batch itself has no extra charge; you pay for the underlying resources. Pairing Batch with Spot Instances is a common low-cost pattern for interruption-tolerant work.
Elastic Beanstalk (revisited)
Chapter 8 introduced AWS Elastic Beanstalk, which deploys web applications onto EC2, load balancers, and Auto Scaling for you. It belongs on the compute map too: it gives you the convenience of a platform while leaving the EC2 instances visible and adjustable in your account.
9.8 Choosing the right compute service
On the exam, compute questions are usually decided by one or two keywords. Work through these questions in order:
- 1. Does the code run in response to events and finish within 15 minutes? Choose Lambda.
- 2. Is the application packaged as containers? Choose ECS (AWS-native) or EKS (Kubernetes). Add Fargate if the team does not want to manage servers.
- 3. Is it a simple website or app for someone who wants fixed monthly pricing? Choose Lightsail.
- 4. Is it a web application where developers just want to upload code? Choose Elastic Beanstalk or App Runner.
- 5. Is it a queue of large batch jobs? Choose AWS Batch.
- 6. Does the workload need full control of the OS, special software, or specific hardware? Choose EC2, picking the instance family that matches the workload.
Which compute service?
Event-driven code that finishes
within 15 minutes?
Packaged as containers?
(Kubernetes needed: EKS, otherwise ECS)
Simple site or app, fixed monthly price,
little cloud experience?
Web app: developers just want to
upload code and have it run?
Large queue of independent
batch jobs?
Need full OS control, custom software,
or specific hardware?
Add EC2 Auto Scaling + Elastic Load Balancing for elastic, highly available EC2 fleets.
Moving up the list means less to manage and more handled by AWS.
Figure 9.6: A decision tree for choosing a compute service. Start at the top and follow the first branch that matches the scenario.
Real-world example
Real-world scenario: A photo-sharing startup has three needs. Its public website is a containerized application, so it runs on ECS with Fargate behind an Application Load Balancer. When users upload photos to S3, a Lambda function creates thumbnails. Every night, a large set of image-recognition jobs runs on AWS Batch using Spot Instances. Each piece uses the compute model that fits it best, which is exactly how real architectures, and good exam answers, are built.
Chapter 9 summary
EC2 provides virtual servers with full OS control; you choose an AMI, an instance type, a key pair, network settings, storage, and optional user data.
Instance families match workloads: general purpose (M, T), compute optimized (C), memory optimized (R, X), accelerated (P, G, Inf, Trn), and storage optimized (I, D). Graviton (ARM) instances offer strong price-performance and energy efficiency.
EBS-backed instances keep their root volume when stopped; instance store is fast but ephemeral.
EC2 Auto Scaling maintains min, desired, and max capacity, replaces unhealthy instances, and scales out and in (target tracking, step, scheduled, predictive).
Elastic Load Balancing distributes traffic across healthy targets in multiple AZs: ALB for HTTP routing, NLB for high-performance TCP/UDP, GWLB for virtual appliances.
Lambda runs event-driven code up to 15 minutes, with 128 MB to 10 GB of memory, priced per request and per GB-second of duration.
ECR stores container images, ECS and EKS orchestrate containers, and Fargate runs them without servers. App Runner and Elastic Beanstalk simplify web app deployment, Lightsail offers simple fixed-price servers, and Batch runs large-scale batch jobs.
- Key terms
- Term Meaning
- Instance A virtual server in EC2
- AMI Template containing the OS and software foran instance
- Instance type CPU, memory, storage, and network size ofan instance
- Graviton AWS-designed ARM processor for EC2
- User data Script that runsat first boot
- Key pair Public/private keys for SSH or Windows password
- Auto Scaling group Fleet that keeps min/desired/max instances
- Elastic Load Balancing Spreads traffic across healthy targets
- AWS Lambda Serverless, event-driven functions
- Amazon ECS AWS-native container orchestrator
- Amazon EKS Managed Kubernetes
- AWS Fargate Serverless compute engine for containers
- Amazon ECR Private container image registry
- Amazon Lightsail Simple serversata predictable monthly price
- AWS Batch Managed batch job scheduling and compute
- Practice questions
- 1. A company runs an in-memory database that needs a very large amount of RAM. Which EC2 instance family is most appropriate?
- A. Compute optimized B. Memory optimized
- C. Storage optimized D. General purpose burstable (T)
- 2. What does an Amazon Machine Image (AMI) provide?
- A. The network configuration for a VPC B. The template for an instance’s root volume, including the operating system
- C. The private key used to connect to an instance D. A backup of an S3 bucket
- 3. A developer wants every new EC2 instance to install a web server automatically the first time it boots. Which feature should they use?
- A. Key pairs B. User data
- C. Security groups D. Instance store
- 4. A company wants to reduce compute costs and energy consumption for Linux workloads on EC2 without changing the application logic. Which option should it evaluate?
- A. Instances powered by AWS Graviton processors B. Dedicated Hosts
- C. Larger instance sizes D. Instance store volumes
- 5. An e-commerce site has unpredictable traffic spikes. The company wants capacity to increase automatically during spikes and decrease afterward. Which service provides this?
- A. Elastic Load Balancing B. Amazon EC2 Auto Scaling
- C. AWS Batch D. Amazon ECR
- 6. Which load balancer should be used to route HTTP requests to different target groups based on the URL path?
- A. Network Load Balancer B. Gateway Load Balancer
- C. Application Load Balancer D. Classic Load Balancer
- 7. A company needs to deploy a fleet of third-party firewall appliances and transparently route traffic through them. Which load balancer type is designed for this?
- A. Gateway Load Balancer B. Application Load Balancer
- C. Network Load Balancer D. Amazon CloudFront
- 8. Which combination provides a highly available, elastic web tier? (Choose two.)
- A. EC2 instances in a single Availability Zone B. An Auto Scaling group spanning multiple Availability Zones
- C. An Application Load Balancer in front of the instances D. A single large instance with instance store volumes
- E. Amazon Lightsail with a fixed plan
- 9. A company wants to generate thumbnails whenever images are uploaded to an S3 bucket, without managing any servers. Each job takes a few seconds. Which service is best?
- A. Amazon EC2 B. AWS Lambda
- C. Amazon Lightsail D. AWS Outposts
- 10. What is the maximum execution time for a single AWS Lambda invocation?
- A. 5 minutes B. 15 minutes
- C. 1 hour D. 24 hours
- 11. How is AWS Lambda priced? (Choose two.)
- A. Number of requests B. Number of servers provisioned
- C. Duration of execution, based on allocated memory D. A fixed monthly fee per function
- E. Number of Availability Zones used
- 12. A company runs Kubernetes on premises and wants a managed Kubernetes service on AWS. Which service should it use?
- A. Amazon ECS B. Amazon EKS
- C. AWS Fargate D. AWS App Runner
- 13. A team wants to run containers on Amazon ECS without provisioning, patching, or scaling EC2 instances. What should it use?
- A. AWS Fargate B. Amazon ECR
- C. Amazon EC2 Auto Scaling D. AWS Elastic Beanstalk
- 14. Where should a company store its private Docker container images for use with Amazon ECS?
- A. Amazon EBS B. Amazon ECR
- C. AWS Lambda layers D. Amazon EFS
- 15. A small business owner with little cloud experience wants to host a WordPress blog for a low, predictable monthly price. Which service is the best fit?
- A. Amazon EKS B. Amazon Lightsail
- C. AWS Batch D. Amazon EC2 Dedicated Hosts
- 16. A research lab needs to run thousands of independent simulation jobs overnight and wants AWS to provision and scale the compute automatically. Which service fits best?
- A. AWS Batch B. AWS Lambda
- C. Amazon Lightsail D. Elastic Load Balancing
- 17. A developer wants to deploy a containerized web API from source code with automatic builds, HTTPS, load balancing, and scaling, without configuring clusters or load balancers. Which service fits best?
- A. Amazon EC2 B. AWS App Runner
- C. AWS Batch D. Amazon ECR
- 18. Which statement about EC2 instance store volumes is correct?
- A. Data persists after the instance is stopped B. They are network-attached and can be detached and reattached
- C. Data is lost if the instance is stopped or terminated D. They are replicated automatically across Availability Zones
Answers and explanations
- 1. B. Memory optimized instances (R, X) provide large amounts of RAM for in-memory databases. Compute optimized favors CPU, and burstable T instances are for light, variable workloads.
- 2. B. An AMI is the template for an instance’s root volume with the OS and software. Key pairs, VPC settings, and backups are separate.
- 3. B. User data runs a script at first boot to install and configure software. Key pairs are for access, and security groups are firewalls.
- 4. A. Graviton-based instances offer better price-performance and energy efficiency for many Linux workloads. Dedicated Hosts and larger sizes increase cost.
- 5. B. EC2 Auto Scaling adds and removes instances based on demand. ELB distributes traffic but does not add capacity.
- 6. C. The ALB operates at layer 7 and supports path- and host-based routing. The NLB works at layer 4 and cannot inspect URL paths.
- 7. A. The Gateway Load Balancer is built for deploying and scaling third-party virtual appliances such as firewalls. ALB and NLB distribute application traffic.
- 8. B and C. An Auto Scaling group across multiple AZs provides elasticity and resilience, and an ALB distributes traffic among healthy instances. A single AZ or single instance is a single point of failure.
- 9. B. Lambda runs short, event-driven code triggered by S3 uploads with no servers to manage. EC2 and Lightsail require server management.
- 10. B. Lambda functions can run for up to 15 minutes. Longer jobs belong on EC2, containers, or Batch.
- 11. A and C. Lambda charges per request and for duration weighted by allocated memory (GB-seconds). There are no servers or fixed monthly fees.
- 12. B. EKS is managed Kubernetes and fits existing Kubernetes skills and tools. ECS is AWS’s own orchestrator, and Fargate is a compute engine, not an orchestrator.
- 13. A. Fargate runs ECS tasks without managing servers. ECR stores images, and Auto Scaling manages EC2 instances.
- 14. B. ECR is AWS’s managed container image registry. EBS and EFS are block and file storage, not registries.
- 15. B. Lightsail offers simple bundles at predictable monthly prices for users new to the cloud. EKS and Dedicated Hosts are complex and costly for this need.
- 16. A. AWS Batch queues and runs large numbers of batch jobs and scales compute automatically. Lambda’s 15-minute limit and model do not suit long simulations.
- 17. B. App Runner builds and runs web apps and APIs from source or images with HTTPS, load balancing, and scaling built in. EC2 needs manual setup, and ECR only stores images.
- 18. C. Instance store is ephemeral, so data is lost on stop, hibernate, terminate, or host failure. EBS volumes, not instance store, are network-attached and persistent.