0
0
AWScloud~10 mins

Right-sizing resources in AWS - Interactive Code Practice

Choose your learning style9 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.