Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Instance types and families
📖 Scenario: You are setting up a cloud environment and need to organize information about different AWS EC2 instance types and their families. This will help you choose the right instance for your applications.
🎯 Goal: Create a dictionary that holds AWS EC2 instance types grouped by their families. Then, add a configuration variable to select a family, filter the instance types by that family, and finally output the filtered list.
📋 What You'll Learn
Create a dictionary called instance_families with exact keys and values
Add a variable called selected_family with a specific family name
Use a list comprehension called filtered_instances to select instances from the chosen family
Add a final line that assigns result to filtered_instances
💡 Why This Matters
🌍 Real World
Organizing instance types by family helps cloud architects quickly select the right compute resources for different workloads.
💼 Career
Understanding instance types and families is essential for roles like cloud engineer, solutions architect, and DevOps specialist.
Progress0 / 4 steps
1
Create the instance families dictionary
Create a dictionary called instance_families with these exact entries: 'general_purpose': ['t2.micro', 't3.medium', 't3.large'], 'compute_optimized': ['c4.large', 'c5.xlarge', 'c5.2xlarge'], and 'memory_optimized': ['r4.large', 'r5.xlarge', 'r5.2xlarge'].
AWS
Hint
Use curly braces to create a dictionary. Each key is a string and each value is a list of strings.
2
Add a selected family variable
Add a variable called selected_family and set it to the string 'compute_optimized'.
AWS
Hint
Assign the string 'compute_optimized' to the variable selected_family.
3
Filter instances by selected family
Create a list called filtered_instances using a list comprehension that selects all instance types from instance_families[selected_family].
AWS
Hint
Use a list comprehension to copy all instances from the selected family list.
4
Assign the final result
Add a line that assigns the variable result to the value of filtered_instances.
AWS
Hint
Simply assign the list filtered_instances to the variable result.
Practice
(1/5)
1. Which AWS instance family is best suited for general purpose workloads like web servers and small databases?
easy
A. C family (e.g., c5, c6g)
B. P family (e.g., p3, p4)
C. R family (e.g., r5, r6g)
D. T family (e.g., t3, t4g)
Solution
Step 1: Understand instance family purposes
The T family is designed for general purpose workloads with balanced CPU and memory.
Step 2: Match workload type to instance family
Web servers and small databases typically need balanced resources, fitting T family well.
Final Answer:
T family (e.g., t3, t4g) -> Option D
Quick Check:
General purpose = T family [OK]
Hint: General purpose = T family instances [OK]
Common Mistakes:
Confusing compute-optimized C family for general purpose
Choosing memory-optimized R family for small databases
Selecting GPU P family for simple web servers
2. Which of the following is the correct syntax to specify a compute-optimized instance type in AWS?
easy
A. t3.large
B. c5.large
C. r5.large
D. m5.large
Solution
Step 1: Identify compute-optimized prefix
Compute-optimized instances start with 'c' (e.g., c5, c6g).
Step 2: Check instance type format
Correct format is family + size, like 'c5.large'.
Final Answer:
c5.large -> Option B
Quick Check:
Compute-optimized = c5.large [OK]
Hint: Compute-optimized instances start with 'c' [OK]
Common Mistakes:
Choosing m5.large which is general purpose
Selecting r5.large which is memory optimized
Using t3.large which is burstable general purpose
3. Given the following instance types, which one provides the highest memory capacity per vCPU?
A) m5.large
B) c5.large
C) r5.large
D) t3.large
medium
A. r5.large
B. c5.large
C. m5.large
D. t3.large
Solution
Step 1: Understand instance family memory focus
R family is memory optimized, offering more memory per vCPU than others.
Confusing compute-optimized c5.large as memory heavy
Thinking burstable t3.large has highest memory per vCPU
4. You launched an instance with type c5.large but your application needs more memory. Which instance type should you choose to fix this issue without changing the CPU count?
medium
A. r5.large
B. c5.xlarge
C. t3.large
D. m5.large
Solution
Step 1: Identify current instance specs
c5.large has 2 vCPUs and 4 GiB memory.
Step 2: Find instance with same vCPU but more memory
r5.large has 2 vCPUs and 16 GiB memory, increasing memory without changing CPU count.
Final Answer:
r5.large -> Option A
Quick Check:
More memory, same CPU = r5.large [OK]
Hint: Keep vCPU same, pick memory-optimized with same size [OK]
Common Mistakes:
Choosing c5.xlarge which doubles CPU and memory
Picking t3.large which is burstable, not memory optimized
Selecting m5.large which has less memory (8 GiB) than r5.large
5. You need to run a machine learning training job that requires high GPU performance and large memory. Which instance family and size combination is the best fit?
hard
A. r5.12xlarge
B. c5.4xlarge
C. p4d.24xlarge
D. t3.2xlarge
Solution
Step 1: Identify instance families for GPU workloads
P family instances are designed for GPU-intensive tasks like machine learning.
Step 2: Choose size with high GPU and memory
p4d.24xlarge offers multiple GPUs and large memory, ideal for training jobs.
Final Answer:
p4d.24xlarge -> Option C
Quick Check:
GPU + large memory = p4d.24xlarge [OK]
Hint: GPU needs = P family, largest size for training [OK]
Common Mistakes:
Picking c5.4xlarge which lacks GPUs
Choosing r5.12xlarge which is memory optimized but no GPU
Selecting t3.2xlarge which is burstable general purpose