0
0
AWScloud~10 mins

High availability design patterns 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 create a highly available web server using AWS Elastic Load Balancer.

AWS
resource "aws_elb" "web_elb" {
  name               = "web-elb"
  availability_zones = ["us-east-1a", "us-east-1b"]
  listener {
    instance_port     = 80
    instance_protocol = "HTTP"
    lb_port           = 80
    lb_protocol       = [1]
  }
}
Drag options to blanks, or click blank then click option'
AHTTPS
BSSL
CTCP
DHTTP
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing HTTPS for port 80 causes connection errors.
Using TCP or SSL protocols for HTTP traffic is incorrect.
2fill in blank
medium

Complete the code to define an Auto Scaling group with a minimum of 2 instances for high availability.

AWS
resource "aws_autoscaling_group" "web_asg" {
  name                      = "web-asg"
  max_size                  = 5
  min_size                  = [1]
  desired_capacity          = 3
  launch_configuration      = aws_launch_configuration.web_lc.name
  availability_zones        = ["us-east-1a", "us-east-1b"]
}
Drag options to blanks, or click blank then click option'
A1
B2
C0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Setting min_size to 1 risks downtime if that instance fails.
Setting min_size to 0 disables instances.
3fill in blank
hard

Fix the error in the Route 53 health check configuration to improve availability.

AWS
resource "aws_route53_health_check" "web_health_check" {
  fqdn              = "example.com"
  port              = 80
  type              = [1]
  failure_threshold = 3
}
Drag options to blanks, or click blank then click option'
AHTTP
BHTTPS
CTCP
DSSL
Attempts:
3 left
💡 Hint
Common Mistakes
Using HTTPS or SSL on port 80 causes health check to fail.
Using TCP does not check HTTP response status.
4fill in blank
hard

Fill both blanks to configure a multi-AZ RDS instance for high availability.

AWS
resource "aws_db_instance" "mydb" {
  allocated_storage    = 20
  engine               = "mysql"
  instance_class       = [1]
  multi_az             = [2]
  identifier           = "mydb"
  username             = "admin"
  password             = "password"
  skip_final_snapshot  = true
}
Drag options to blanks, or click blank then click option'
Adb.m5.large
Bdb.t2.micro
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using a micro instance class is not recommended for production.
Setting multi_az to false disables high availability.
5fill in blank
hard

Fill all three blanks to create a CloudWatch alarm that triggers when CPU usage is high.

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           = [2]
  threshold           = 80
  alarm_actions       = [aws_sns_topic.alerts.arn]
  dimensions = {
    InstanceId = [3]
  }
}
Drag options to blanks, or click blank then click option'
AGreaterThanThreshold
BAverage
Cvar.instance_id
DLessThanThreshold
Attempts:
3 left
💡 Hint
Common Mistakes
Using LessThanThreshold triggers alarm on low CPU, which is incorrect.
Using Sum or Maximum instead of Average may not reflect typical usage.
Not specifying the instance ID dimension causes alarm to apply to all instances.