actionAZ:ELB

fail_az

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

Activity as code

Below are the details and signature of the activity Python module.

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:

Optional:

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