Bird
Raised Fist0
AWScloud~10 mins

Right-sizing resources in AWS - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the instance type for right-sizing an EC2 instance.

AWS
resource "aws_instance" "example" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "[1]"
}
Drag options to blanks, or click blank then click option'
At2.micro
Bt1.nano
Cc1.medium
Dm5.large
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing outdated or very small instance types that may not meet workload needs.
2fill in blank
medium

Complete the code to define the desired CPU utilization target for an Auto Scaling group policy.

AWS
resource "aws_autoscaling_policy" "cpu_target" {
  name                   = "cpu-target"
  autoscaling_group_name = aws_autoscaling_group.example.name
  policy_type            = "TargetTrackingScaling"
  target_tracking_configuration {
    predefined_metric_specification {
      predefined_metric_type = "ASGAverageCPUUtilization"
    }
    target_value = [1]
  }
}
Drag options to blanks, or click blank then click option'
A75.0
B90.0
C50.0
D25.0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the target value too high or too low, causing scaling inefficiencies.
3fill in blank
hard

Fix the error in the launch configuration by selecting the correct block to specify the root block device size.

AWS
resource "aws_launch_configuration" "example" {
  name_prefix   = "example-"
  image_id      = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.medium"

  [1] {
    volume_size = 30
  }
}
Drag options to blanks, or click blank then click option'
Ablock_device_mappings
Broot_block_device
Cebs_block_device
Dstorage_device
Attempts:
3 left
💡 Hint
Common Mistakes
Using ebs_block_device instead of root_block_device for the root volume.
4fill in blank
hard

Fill both blanks to create a CloudWatch alarm that triggers when CPU utilization exceeds a threshold.

AWS
resource "aws_cloudwatch_metric_alarm" "high_cpu" {
  alarm_name          = "high_cpu_alarm"
  comparison_operator = "[1]"
  evaluation_periods  = 2
  metric_name         = "CPUUtilization"
  namespace           = "AWS/EC2"
  period              = 300
  statistic           = "Average"
  threshold           = [2]
  alarm_description   = "Alarm when CPU exceeds threshold"
  dimensions = {
    InstanceId = aws_instance.example.id
  }
}
Drag options to blanks, or click blank then click option'
AGreaterThanThreshold
BLessThanThreshold
C80
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Using LessThanThreshold for high CPU alarms.
Setting threshold too low or too high.
5fill in blank
hard

Fill all three blanks to define an Auto Scaling group with a desired capacity and health check type.

AWS
resource "aws_autoscaling_group" "example" {
  name                      = "example-asg"
  max_size                  = 5
  min_size                  = 1
  desired_capacity          = [1]
  launch_configuration      = aws_launch_configuration.example.name
  health_check_type         = "[2]"
  health_check_grace_period = [3]
  vpc_zone_identifier       = ["subnet-12345678"]
}
Drag options to blanks, or click blank then click option'
A3
BEC2
C300
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting desired capacity outside min-max range.
Using incorrect health check type string.
Setting grace period too low or too high.

Practice

(1/5)
1. What does right-sizing mean in cloud resource management?
easy
A. Always picking the largest resource available
B. Choosing the best resource size to match your actual needs
C. Using resources without monitoring their usage
D. Ignoring cost and focusing only on performance

Solution

  1. Step 1: Understand the meaning of right-sizing

    Right-sizing means selecting resources that fit your workload requirements without waste.
  2. Step 2: Compare options to definition

    Only Choosing the best resource size to match your actual needs matches the idea of matching resource size to actual needs.
  3. Final Answer:

    Choosing the best resource size to match your actual needs -> Option B
  4. Quick Check:

    Right-sizing = best fit resource size [OK]
Hint: Right-sizing means matching size to need, not max or ignore usage [OK]
Common Mistakes:
  • Thinking right-sizing means always picking the biggest resource
  • Ignoring usage data when choosing resources
  • Confusing right-sizing with ignoring costs
2. Which AWS service helps you analyze resource usage to right-size your EC2 instances?
easy
A. AWS CloudTrail
B. AWS Cost Explorer
C. AWS Trusted Advisor
D. AWS Lambda

Solution

  1. Step 1: Identify AWS services for resource optimization

    AWS Trusted Advisor provides recommendations including right-sizing EC2 instances.
  2. Step 2: Eliminate unrelated services

    CloudTrail logs API calls, Cost Explorer shows costs, Lambda runs code; only Trusted Advisor analyzes usage for right-sizing.
  3. Final Answer:

    AWS Trusted Advisor -> Option C
  4. Quick Check:

    Trusted Advisor = right-sizing help [OK]
Hint: Trusted Advisor gives right-sizing tips for EC2 [OK]
Common Mistakes:
  • Confusing CloudTrail with usage analysis
  • Thinking Cost Explorer directly suggests right-sizing
  • Selecting Lambda which is unrelated to resource sizing
3. You have an EC2 instance running at 10% CPU most of the time. What is the likely output of a right-sizing recommendation script?
medium
A. Recommend upgrading to a larger instance type
B. Recommend no change to instance size
C. Recommend terminating the instance
D. Recommend downgrading to a smaller instance type

Solution

  1. Step 1: Analyze CPU usage data

    10% CPU usage means the instance is underutilized and likely oversized.
  2. Step 2: Determine right-sizing action

    Underutilization suggests downgrading to a smaller instance to save cost.
  3. Final Answer:

    Recommend downgrading to a smaller instance type -> Option D
  4. Quick Check:

    Low CPU usage = downsize instance [OK]
Hint: Low CPU means smaller instance recommended [OK]
Common Mistakes:
  • Choosing to upgrade when usage is low
  • Thinking no change is needed despite low usage
  • Confusing termination with right-sizing
4. A user tries to right-size an EC2 instance but gets an error: "Instance type not supported in this AZ." What is the best fix?
medium
A. Change the instance type to one supported in the availability zone
B. Ignore the error and try again
C. Terminate the instance immediately
D. Switch to a different AWS region without checking

Solution

  1. Step 1: Understand the error context

    The error means the chosen instance type is not available in the current availability zone.
  2. Step 2: Apply correct fix

    Selecting an instance type supported in the same availability zone resolves the error.
  3. Final Answer:

    Change the instance type to one supported in the availability zone -> Option A
  4. Quick Check:

    Unsupported instance type in AZ = pick supported type [OK]
Hint: Pick instance types supported in your AZ [OK]
Common Mistakes:
  • Ignoring the error and retrying
  • Terminating instance without fixing
  • Switching regions without checking availability
5. You manage a fleet of EC2 instances with varying CPU usage. Which approach best applies right-sizing to reduce costs without hurting performance?
hard
A. Start with smallest instance types, monitor usage, then scale up as needed
B. Always pick the largest instance type to avoid performance issues
C. Randomly change instance types monthly without monitoring
D. Terminate all instances and switch to on-demand only

Solution

  1. Step 1: Understand right-sizing best practice

    Right-sizing means starting small and adjusting based on real usage data to avoid waste.
  2. Step 2: Evaluate options for cost and performance balance

    Start with smallest instance types, monitor usage, then scale up as needed follows best practice by starting small, monitoring, and scaling up only if needed.
  3. Final Answer:

    Start with smallest instance types, monitor usage, then scale up as needed -> Option A
  4. Quick Check:

    Start small + monitor + scale = right-sizing [OK]
Hint: Start small, watch usage, then adjust size [OK]
Common Mistakes:
  • Always picking largest instance wastes money
  • Changing types randomly causes instability
  • Terminating all instances ignores workload needs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard