Auto Scaling group does not span two or more Availability Zones Affecting EC2 service in AWS


Severity

0.0
medium
0
10
Severity Framework
Snyk CCSS
Rule category
Availability/ Redundancy

Is your environment 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
AWS-Well-ArchitectedCSA-CCMGDPRISO-27001NIST-800-53SOC-2
  • Snyk IDSNYK-CC-00167
  • creditSnyk Research Team

Description

Auto Scaling groups that span two or more Availability Zones promote redundancy of data, which helps ensure availability and continuity during an adverse situation.

How to fix?

Set vpc_zone_identifier to two or more subnets, or set availability_zones to two or more Availability Zones.

Example Configuration

# with vpc_zone_identifier
resource "aws_autoscaling_group" "tf_asg_example" {
  name                 = "terraform-asg-example"
  vpc_zone_identifier  = [aws_subnet.subnet1.id, aws_subnet.subnet2.id]
  launch_configuration = "${aws_launch_configuration.as_conf.name}"
  min_size             = 1
  max_size             = 2

  lifecycle {
    create_before_destroy = true
  }
}

# with availability_zones
resource "aws_autoscaling_group" "example" {
  availability_zones = ["us-east-1a", "us-east-1b"]
  desired_capacity   = 1
  max_size           = 1
  min_size           = 1

  launch_template {
    id      = aws_launch_template.example.id
    version = "$Latest"
  }
}