Instance states (running, stopped, terminated)
📖 Scenario: You are managing cloud servers called instances. Each instance can be in one of three states: running, stopped, or terminated. You want to keep track of these states to manage your cloud resources efficiently.
🎯 Goal: Create a simple data structure to hold instance IDs and their states. Then, add a configuration variable to select which state to filter. Next, write code to find all instances in that selected state. Finally, complete the setup by preparing the filtered list for further management.
📋 What You'll Learn
Create a dictionary named
instances with exact instance IDs as keys and their states as values.Add a variable named
selected_state with the value 'running'.Use a dictionary comprehension named
filtered_instances to select instances matching selected_state.Add a final line to create a list named
instance_ids containing only the keys from filtered_instances.💡 Why This Matters
🌍 Real World
Cloud administrators often need to track and manage instances based on their states to optimize costs and performance.
💼 Career
Understanding instance states and filtering them is a fundamental skill for cloud engineers and DevOps professionals managing AWS resources.
Progress0 / 4 steps