EC2 is unable to replace unhealthy instances Affecting EC2 service in AWS


Severity

0.0
medium
0
10
    Severity Framework
    Snyk CCSS
    Rule category
    General / Restoration

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
  • Snyk ID SNYK-CC-00264
  • credit Snyk Research Team

Description

Availability of the service may be impacted if unhealthy instances are not replaced.

How to fix?

Set replace_unhealthy_instances attribute to true.

Example Configuration

resource "aws_ec2_fleet" "fleet1" {
  launch_template_config {
    launch_template_specification {
      launch_template_id = "aws_launch_template.example.id"
      version            = "aws_launch_template.example.latest_version"

    }
  }
  target_capacity_specification {
    default_target_capacity_type = "spot"
    total_target_capacity        = 5

  }
  replace_unhealthy_instances = true

}