action AZ:ELB

fail_az

Simulates the loss of an AZ in an AWS Region for classic LBs

Run it now
View details
Typeaction
Moduleazchaosaws.elb.actions
Namefail_az
Returnmapping

This function simulates the loss of an AZ in an AWS Region for classic LBs by detaching the LB from subnets of the ‘failed’ az. If LB is in a default VPC disables the ‘failed’ az for the LB.

Notes:

Detaching lb from subnets: After a subnet is removed, all EC2 instances registered with the load balancer in the removed subnet go into the OutOfService state. Then, the load balancer balances the traffic among the remaining routable subnets.

Disabling az for lb: There must be at least one Availability Zone registered with a load balancer at all times. After an Availability Zone is removed, all instances registered with the load balancer that are in the removed Availability Zone go into the OutOfService state. Then, the load balancer attempts to equally balance the traffic among its remaining Availability Zones.

Usage

JSON

{
  "name": "fail_az",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "azchaosaws.elb.actions",
    "func": "fail_az",
    "arguments": {
      "az": "",
      "dry_run": true
    }
  }
}

YAML

name: fail_az
provider:
  arguments:
    az: ""
    dry_run: true
  func: fail_az
  module: azchaosaws.elb.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
azstringYesAvailability ZoneAZ to target
tagsList[Dict[str, str]][{"Key": "AZ_FAILURE", "Value": "True"}]NoTagsMatch only resources with these tags
lb_namesList[str]nullNoLoad-Balancer NamesName of the LB to target rather than tags
dry_runboolfalseNoDry RunOnly perform a dry run for it

Required:

  • az (str): An availability zone
  • dry_run (bool): The boolean flag to simulate a dry run or not. Setting to True will only run read-only operations and not make changes to resources. (Accepted values: True | False)

Optional:

  • lb_names (List[str]): A list of LB names
  • tags (List[Dict[str, str]]): A list of key-value pairs to filter the ELB(s) by. (Default: [{"Key": "AZ_FAILURE", "Value": "True"}])
  • state_path (str): Path to generate the state data (Default: fail_az.elb.json). This file is used for recover_az (rollback).

Return structure

{
  "AvailabilityZone": str,
  "DryRun": bool,
  "LoadBalancers": [
    {
      "LoadBalancerName": str,
      "Type": "Classic",
      "Before": {
        "SubnetIds": List[str],
        "AvailabilityZones": List[str]
      },
      "After": {
        "SubnetIds": List[str],
        "AvailabilityZones": List[str]
      }
    }
  ]
}

Signature

def fail_az(
    az: str = None,
    dry_run: bool = None,
    lb_names: List[str] = None,
    tags: List[Dict[str, Any]] = [{"Key": "AZ_FAILURE", "Value": "True"}],
    state_path: str = "fail_az.{}.json".format(__package__.split(".", 1)[1]),
    configuration: Configuration = None,
) -> Dict[str, Any]:
    pass