Security pillar principles in AWS - Time & Space Complexity
We want to understand how the time to enforce security controls grows as we add more resources or users in AWS.
How does the effort to keep things secure change when the system grows?
Analyze the time complexity of applying security policies to multiple AWS resources.
// Example: Attaching IAM policies to multiple EC2 instances
for each instance in instances:
attach IAM role with security policies
enable logging and monitoring
configure security groups
This sequence applies security settings to each EC2 instance to protect it.
Look at what repeats as the number of instances grows.
- Primary operation: Attaching IAM roles and configuring security groups per instance.
- How many times: Once for each instance.
Each new instance requires its own security setup, so the work grows with the number of instances.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 security setups |
| 100 | 100 security setups |
| 1000 | 1000 security setups |
Pattern observation: The work grows directly with the number of instances.
Time Complexity: O(n)
This means the time to apply security controls increases linearly as you add more resources.
[X] Wrong: "Applying security policies once will cover all resources automatically."
[OK] Correct: Each resource needs its own security setup; policies don't apply automatically to new resources without explicit attachment.
Understanding how security tasks scale helps you design systems that stay safe as they grow, a key skill in cloud roles.
"What if we used a centralized security group for all instances? How would the time complexity change?"