Bird
Raised Fist0
AWScloud~10 mins

High availability design patterns 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 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.

Practice

(1/5)
1. What is the main goal of a high availability design pattern in AWS?
easy
A. To reduce the cost of cloud resources
B. To keep the application running even if some parts fail
C. To increase the speed of the application only
D. To limit the number of users accessing the app

Solution

  1. Step 1: Understand high availability concept

    High availability means designing systems to stay online and functional despite failures.
  2. Step 2: Match goal with options

    Only To keep the application running even if some parts fail describes keeping the app running during failures, which is the goal.
  3. Final Answer:

    To keep the application running even if some parts fail -> Option B
  4. Quick Check:

    High availability = keep running despite failures [OK]
Hint: High availability means no downtime during failures [OK]
Common Mistakes:
  • Confusing cost reduction with availability
  • Thinking speed alone defines high availability
  • Assuming limiting users improves availability
2. Which AWS service is commonly used to distribute incoming traffic across multiple instances for high availability?
easy
A. Amazon S3
B. AWS Lambda
C. Amazon RDS
D. Elastic Load Balancer (ELB)

Solution

  1. Step 1: Identify service for traffic distribution

    Elastic Load Balancer (ELB) distributes traffic to multiple instances to avoid single points of failure.
  2. Step 2: Eliminate other options

    Amazon S3 stores files, RDS is a database, Lambda runs code; none distribute traffic.
  3. Final Answer:

    Elastic Load Balancer (ELB) -> Option D
  4. Quick Check:

    Traffic distribution = ELB [OK]
Hint: Load balancers spread traffic to keep apps available [OK]
Common Mistakes:
  • Choosing storage or compute services instead of load balancer
  • Confusing Lambda with traffic distribution
  • Selecting database services for traffic handling
3. Consider this AWS setup: An application runs in two Availability Zones (AZs) behind an Elastic Load Balancer. If one AZ fails, what happens to the app availability?
medium
A. The app slows down but stays available in the failed AZ
B. The app becomes completely unavailable
C. The app continues running using the healthy AZ
D. The app automatically scales down to zero instances

Solution

  1. Step 1: Understand multi-AZ deployment

    Running in multiple AZs means if one AZ fails, others can serve traffic.
  2. Step 2: Analyze ELB behavior

    ELB routes traffic only to healthy instances, so app stays available in the healthy AZ.
  3. Final Answer:

    The app continues running using the healthy AZ -> Option C
  4. Quick Check:

    Multi-AZ + ELB = app stays available [OK]
Hint: Multi-AZ with ELB keeps app running if one AZ fails [OK]
Common Mistakes:
  • Assuming total outage if one AZ fails
  • Thinking app slows but serves from failed AZ
  • Believing app scales down automatically on failure
4. You configured an Auto Scaling group with minimum 2 instances across two AZs, but during a failure, only one instance is running. What is the likely issue?
medium
A. Auto Scaling group is not set to replace unhealthy instances
B. Load balancer is misconfigured to route traffic
C. Instances are launched in the same AZ only
D. Security groups block instance communication

Solution

  1. Step 1: Check Auto Scaling group settings

    Auto Scaling must replace unhealthy instances to maintain minimum capacity.
  2. Step 2: Understand failure impact

    If replacement is disabled, failed instance won't be replaced, causing fewer running instances.
  3. Final Answer:

    Auto Scaling group is not set to replace unhealthy instances -> Option A
  4. Quick Check:

    Auto Scaling replaces unhealthy = maintain capacity [OK]
Hint: Auto Scaling must replace failed instances to keep count [OK]
Common Mistakes:
  • Blaming load balancer for instance count
  • Assuming instances launched only in one AZ
  • Thinking security groups affect instance count
5. You want to design a highly available web app on AWS that stays online even if an entire region fails. Which combination should you use?
hard
A. Deploy instances in multiple regions with Route 53 latency-based routing and health checks
B. Deploy instances in multiple AZs within one region and use an Elastic Load Balancer
C. Use a single instance in one AZ with Auto Scaling enabled
D. Deploy instances in one AZ and use Amazon S3 for static content

Solution

  1. Step 1: Understand region failure scope

    Multi-AZ protects against AZ failure, but not entire region failure.
  2. Step 2: Choose multi-region design

    Deploying in multiple regions with Route 53 routing and health checks ensures availability if one region fails.
  3. Final Answer:

    Deploy instances in multiple regions with Route 53 latency-based routing and health checks -> Option A
  4. Quick Check:

    Multi-region + Route 53 = survive region failure [OK]
Hint: Multi-region with Route 53 handles region failures [OK]
Common Mistakes:
  • Thinking multi-AZ covers region failure
  • Relying on single instance with Auto Scaling
  • Ignoring DNS routing for multi-region failover
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