Skip to content

CLF-C02 Study Notes: Identify AWS Compute Services

1. Amazon EC2

What is Amazon EC2?

Amazon Elastic Compute Cloud (Amazon EC2) provides resizable virtual servers in the AWS Cloud.

  • EC2 is an Infrastructure as a Service (IaaS) offering.
  • An EC2 instance is a virtual machine running on physical hardware managed by AWS.
  • You select the operating system, instance type, storage, networking, and security configuration.
  • EC2 is the traditional choice when you need significant control over the operating system and server environment.

Virtualization

Virtualization allows multiple operating systems and applications to run on the same physical server while remaining isolated from one another.

In AWS:

  • The physical hardware is an EC2 host.
  • Virtual machines running on the host are EC2 instances.
  • AWS manages the underlying physical hosts.

2. EC2 Hosts

Shared Hosts

Shared tenancy is the default for EC2 instances.

  • Multiple AWS customers may use the same physical host.
  • Customers remain isolated from one another.
  • You pay for the EC2 instances and resources you use.
  • You do not own or control the physical host.

Dedicated Hosts

A Dedicated Host is a physical EC2 server dedicated to a single AWS customer.

  • You pay for the entire physical host.
  • Other AWS customers do not share the host.
  • Useful when you need:
  • Dedicated physical capacity
  • Visibility into physical sockets and cores
  • Compliance with certain licensing requirements

Exam tip: Dedicated Hosts are different from Dedicated Instances. Dedicated Hosts provide visibility and control over the physical host, while Dedicated Instances run on hardware dedicated to your account but do not provide the same host-level visibility.


3. EC2 Availability Zones and Resilience

EC2 instances run on physical hosts located in a specific Availability Zone (AZ).

  • An EC2 instance is scoped to one AZ.
  • If the AZ fails, EC2 instances in that AZ may become unavailable.
  • To improve availability, deploy instances across multiple AZs.
  • Use an Auto Scaling group and load balancer to distribute workloads across AZs.

Exam trap: EC2 is not automatically multi-AZ. You must launch instances in multiple AZs to achieve multi-AZ availability.


4. EC2 Storage

EC2 Instance Store

Instance store is temporary, locally attached storage physically connected to the EC2 host.

Characteristics:

  • Very high performance
  • Temporary or ephemeral
  • Data can be lost if:
  • The instance is stopped or terminated, depending on the instance configuration
  • The instance is moved to another host
  • The underlying host fails
  • Not suitable as the only location for critical persistent data

Amazon EBS

Amazon Elastic Block Store (Amazon EBS) provides persistent block storage for EC2 instances.

Characteristics:

  • Persistent storage designed to survive an instance stop
  • Can be used as boot volumes or data volumes
  • Connected to EC2 through the AWS storage network
  • EBS volumes are associated with a specific Availability Zone

Important limitation:

  • An EBS volume generally must be attached to an EC2 instance in the same AZ.
  • To use the volume in another AZ, create a snapshot and restore it in the other AZ.
Feature Instance Store Amazon EBS
Storage type Local, host-attached Network-attached block storage
Persistence Temporary Persistent
Survives instance stop Generally no Yes
AZ relationship Host-specific AZ-specific
Typical use Temporary cache, scratch data Boot disks, databases, persistent application data

Exam trap: “Persistent” does not mean “multi-AZ.” EBS volumes are persistent but are normally limited to one Availability Zone.


5. EC2 Networking

When an EC2 instance is launched into a subnet in a VPC, AWS provisions a primary Elastic Network Interface (ENI).

An ENI provides networking attributes such as:

  • Private IP address
  • Security groups
  • MAC address
  • Public or Elastic IP association, when configured

You can also attach additional ENIs to an EC2 instance when required.

Exam tip: The subnet and primary ENI determine the Availability Zone in which the EC2 instance runs.


6. EC2 Instance Types

An EC2 instance type determines the resources available to an instance, including:

  • Virtual CPUs
  • Memory
  • Storage capabilities
  • Network bandwidth
  • Specialized hardware, such as GPUs

Different instance types provide different resource ratios. For example:

  • Compute-focused instances provide more CPU relative to memory.
  • Memory-focused instances provide more memory relative to CPU.
  • Network- or storage-intensive instances provide higher throughput for those functions.

Main EC2 Instance Categories

Category Best suited for Typical examples
General Purpose Balanced compute, memory, and networking Web servers, application servers, development environments
Compute Optimized CPU-intensive workloads High-performance computing, media processing, gaming, scientific modeling
Memory Optimized Large in-memory datasets In-memory databases, analytics, database workloads
Accelerated Computing Hardware acceleration Machine learning, graphics processing, GPU workloads, FPGA workloads
Storage Optimized High-volume or low-latency storage operations Data warehousing, analytics, search workloads, high random I/O

Burstable Instances

Burstable instances are designed for workloads that usually have low or moderate CPU usage but occasionally require additional CPU capacity.

  • They accumulate CPU credits during periods of low usage.
  • CPU credits can be used to burst above the baseline level.
  • They are often cost-effective for workloads with variable CPU demand.

Exam trap: Burstable instances are not designed for workloads that require consistently high CPU utilization.

Selecting an Instance Type

Choose an instance type based on:

  1. CPU requirements
  2. Memory requirements
  3. Storage requirements
  4. Network bandwidth
  5. Specialized hardware requirements
  6. Cost and expected workload pattern

7. Amazon Machine Images (AMIs)

An Amazon Machine Image (AMI) is a template used to launch EC2 instances.

An AMI can contain:

  • An operating system
  • Application software
  • Configuration settings
  • Required security or monitoring agents

Custom and Golden AMIs

You can create a custom AMI from an existing EC2 instance.

A golden AMI is a standardized image containing approved:

  • Security patches
  • Software
  • Configuration
  • Logging agents
  • Monitoring agents
  • Security tools

Benefits include:

  • Faster and more consistent instance launches
  • Standardized configurations
  • Reduced manual setup
  • Improved operational consistency

Exam tip: AMIs are templates for launching instances. They are not the same as instance metadata or user data.


8. EC2 Instance Metadata and User Data

Instance Metadata

Instance metadata provides information about the running EC2 instance.

Examples include:

  • Instance ID
  • Instance type
  • Private IP address
  • Public IP address, when available
  • Security group information
  • IAM role or instance profile information
  • Network interface information

It is available from the instance metadata service through a link-local address, commonly represented as:

http://169.254.169.254/latest/meta-data/

Instance User Data

Instance user data is used to pass commands or scripts to an instance when it launches.

Common uses:

  • Installing software
  • Updating packages
  • Configuring services
  • Running startup scripts
  • Performing automated initialization
Feature Instance Metadata Instance User Data
Purpose Information about the instance Startup configuration and scripts
Example Instance ID, IP address, instance type Install a web server during launch
Source AWS provides it User provides it

Exam trap: Use metadata to retrieve information about the instance. Use user data to automate configuration tasks at launch.


9. Container Services

What Are Containers?

Containers package an application and its dependencies into a portable unit.

Unlike traditional virtual machines:

  • Multiple virtual machines each require their own guest operating system.
  • Containers share the host operating system kernel.
  • Containers generally require fewer resources and start faster than virtual machines.
  • Multiple containers can run on the same host.

EC2 Compared with Containers

Feature EC2 Virtual Machines Containers
Operating system Each VM has a guest OS Containers share the host OS kernel
Resource usage Higher overhead Lower overhead
Startup time Generally slower Generally faster
Isolation VM-level isolation Process/container-level isolation
Management You manage the instance OS Container platform manages scheduling and orchestration

Exam tip: Containers are not the same as serverless computing. Containers may still run on EC2 instances and require infrastructure management, depending on the service used.


10. Amazon ECS

Amazon Elastic Container Service (Amazon ECS) is an AWS-managed container orchestration service.

ECS:

  • Runs and manages containers
  • Schedules containers onto available compute resources
  • Uses task and service definitions to describe how containers should run
  • Can be used with AWS networking, load balancing, and scaling services

ECS is a good choice when you want to run containers without managing Kubernetes.

11. Amazon EKS

Amazon Elastic Kubernetes Service (Amazon EKS) is a managed Kubernetes service.

EKS:

  • Runs Kubernetes on AWS
  • Is appropriate when an organization uses Kubernetes or requires Kubernetes compatibility
  • Reduces the operational burden of managing the Kubernetes control plane
Feature Amazon ECS Amazon EKS
Orchestration technology AWS container orchestration Kubernetes
Best for AWS-native container orchestration Kubernetes-based workloads
Complexity Generally simpler More Kubernetes concepts and operational complexity

Exam trap: ECS and EKS are both container orchestration services, but EKS is specifically based on Kubernetes.


12. AWS Lambda

AWS Lambda is a serverless, event-driven compute service.

Lambda runs code in response to events, such as:

  • An object being uploaded to Amazon S3
  • An API request
  • A message arriving in a queue
  • A scheduled event
  • A database or application event

Key characteristics:

  • No servers to provision or manage
  • You upload code as a function
  • Supports runtimes such as Python, Java, and Node.js
  • Automatically handles the underlying compute infrastructure
  • Billing is based primarily on the amount of compute time used and requests

Lambda is a Function as a Service (FaaS) offering and is commonly used in serverless architectures.

Lambda Compared with EC2

Feature Amazon EC2 AWS Lambda
Management You manage the guest OS and instance configuration AWS manages the infrastructure
Execution model Long-running virtual server Event-triggered function
Scaling Configure scaling, often with Auto Scaling Automatically scales based on invocation demand
Billing Instance usage, often while running Requests and execution duration
Best for Full OS control and long-running workloads Short, event-driven application logic

Exam trap: Lambda is not intended to replace every EC2 workload. Choose EC2 when you need operating system control, long-running processes, or specialized server configurations.


13. AWS Elastic Beanstalk

AWS Elastic Beanstalk is an application deployment service.

It helps deploy and manage applications while AWS provisions resources such as:

  • EC2 instances
  • Load balancers
  • Auto Scaling groups
  • Application environments

Elastic Beanstalk is useful when you want to deploy an application without manually creating and managing every underlying AWS resource.

Service Primary purpose
EC2 Full control of virtual servers
Elastic Beanstalk Simplified application deployment and environment management
ECS Container orchestration
EKS Kubernetes orchestration
Lambda Event-driven serverless functions

14. Auto Scaling

An Auto Scaling group (ASG) manages a collection of EC2 instances.

Auto Scaling can:

  • Add instances when demand increases
  • Remove instances when demand decreases
  • Replace unhealthy instances
  • Maintain a desired number of instances
  • Distribute instances across Availability Zones

Auto Scaling provides:

  • Elasticity: automatically adjusts capacity based on demand
  • Fault tolerance: replaces unhealthy instances
  • High availability: can distribute instances across multiple AZs

Exam tip: Auto Scaling does not itself distribute incoming traffic. Use a load balancer for traffic distribution.


15. Elastic Load Balancing

A load balancer distributes incoming traffic across multiple targets, such as:

  • EC2 instances
  • Containers
  • IP addresses
  • Services

Benefits include:

  • Improved availability
  • Fault tolerance
  • Traffic distribution
  • Support for scaling
  • Health checking of targets

A load balancer can deploy nodes across multiple Availability Zones. Using multiple AZs helps ensure that traffic can continue to flow if one AZ becomes unavailable.

Types of Elastic Load Balancers

Load balancer Main use
Application Load Balancer (ALB) HTTP/HTTPS application traffic; Layer 7 routing
Network Load Balancer (NLB) High-performance TCP/UDP/TLS traffic; Layer 4 routing
Gateway Load Balancer (GWLB) Deploying and scaling virtual network appliances such as firewalls
Classic Load Balancer (CLB) Older load balancing option; generally replaced by ALB or NLB for newer designs

Auto Scaling and Load Balancing Together

A common highly available architecture uses:

  1. An Auto Scaling group to launch and terminate EC2 instances.
  2. A load balancer to distribute traffic across those instances.
  3. Multiple Availability Zones for improved fault tolerance.
  4. Health checks to avoid sending traffic to unhealthy instances.

Exam trap:
- Auto Scaling changes the number of instances.
- Load balancing distributes traffic.
They solve different but complementary problems.


Key Comparisons

EC2 vs. Lambda vs. Containers

Requirement Best fit
Need full operating system control EC2
Need to run containerized applications ECS or EKS
Need Kubernetes compatibility EKS
Need simpler AWS-native container orchestration ECS
Need event-driven code without server management Lambda
Need a managed application deployment platform Elastic Beanstalk

High Availability vs. Scalability vs. Elasticity

  • High availability: Designing systems to remain operational despite failures.
  • Scalability: Ability to handle increased workload by adding resources.
  • Elasticity: Ability to automatically add and remove resources as demand changes.
  • Fault tolerance: Ability to continue operating when a component fails.

Exam Tips and Common Traps

  1. EC2 instances are AZ-specific. Deploy instances across multiple AZs for high availability.
  2. EBS is persistent but AZ-specific. It is not automatically replicated across AZs.
  3. Instance store is temporary. Do not use it as the only storage location for important data.
  4. Shared tenancy is the EC2 default.
  5. Dedicated Hosts are billed for the entire physical host, not merely the instances running on it.
  6. Use instance metadata to obtain instance information.
  7. Use instance user data to run startup scripts.
  8. General Purpose is normally the default instance category unless workload requirements indicate otherwise.
  9. Burstable instances are appropriate for workloads with occasional CPU spikes, not sustained high CPU demand.
  10. ECS is AWS container orchestration; EKS is managed Kubernetes.
  11. Lambda is event-driven and serverless. It does not provide a traditional server for you to administer.
  12. Auto Scaling changes capacity; load balancers distribute traffic.
  13. ALB is typically selected for HTTP/HTTPS application routing.
  14. NLB is typically selected for high-performance TCP/UDP/TLS traffic.
  15. GWLB is designed for virtual network appliances.
  16. Elastic Beanstalk simplifies application deployment; it is not the same as EC2 itself.

Example Exam Questions

Question 1

A company needs virtual servers where it can install and manage its own operating system and software. Which AWS service should it use?

A. AWS Lambda
B. Amazon EC2
C. Amazon ECS
D. Amazon S3

Answer: B. Amazon EC2

Explanation: EC2 provides virtual servers with control over the operating system and instance configuration.


Question 2

Which storage option is temporary and located on the physical host running an EC2 instance?

A. Amazon EBS
B. Amazon S3
C. EC2 instance store
D. Amazon EFS

Answer: C. EC2 instance store

Explanation: Instance store provides local, temporary storage. Data may be lost if the instance or underlying host fails.


Question 3

An application requires persistent block storage for an EC2 instance. Which service should be used?

A. Amazon EBS
B. EC2 instance store
C. Amazon CloudFront
D. AWS Lambda

Answer: A. Amazon EBS

Explanation: Amazon EBS provides persistent block storage that can be used for EC2 boot and data volumes.


Question 4

A developer needs to retrieve the instance ID and private IP address from within an EC2 instance. Where should the developer retrieve this information?

A. Instance user data
B. Instance metadata
C. The AMI
D. An Auto Scaling policy

Answer: B. Instance metadata

Explanation: Instance metadata contains information about the running EC2 instance, such as its instance ID and network details.


Question 5

A company has workloads that normally use low CPU but occasionally require additional CPU capacity. Which EC2 option is most appropriate?

A. Burstable instance
B. Memory Optimized instance
C. Storage Optimized instance
D. Dedicated Host

Answer: A. Burstable instance

Explanation: Burstable instances use CPU credits to temporarily increase CPU performance above the baseline.


Question 6

Which service should a company use to run containers using Kubernetes on AWS?

A. Amazon ECS
B. Amazon EKS
C. AWS Lambda
D. AWS Elastic Beanstalk

Answer: B. Amazon EKS

Explanation: Amazon EKS is AWS’s managed Kubernetes service. ECS is AWS’s own container orchestration service.


Question 7

A company wants to execute code automatically whenever a new object is uploaded to an Amazon S3 bucket. Which service is most appropriate?

A. Amazon EC2
B. Amazon EBS
C. AWS Lambda
D. Amazon EKS

Answer: C. AWS Lambda

Explanation: Lambda is an event-driven serverless compute service that can invoke functions in response to events such as S3 uploads.


Question 8

Which combination best supports a highly available and scalable web application running on EC2?

A. One EC2 instance with instance store
B. EC2 instances in multiple AZs behind a load balancer and managed by an Auto Scaling group
C. One Dedicated Host with one EC2 instance
D. One Lambda function without event triggers

Answer: B. EC2 instances in multiple AZs behind a load balancer and managed by an Auto Scaling group

Explanation: The load balancer distributes traffic, the Auto Scaling group adjusts capacity and replaces unhealthy instances, and multiple AZs improve availability.