actionAZ:ASG

fail_az

Simulates the loss of an AZ in an AWS Region for AutoScalingGroups

Activity as code

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

Typeaction
Moduleazchaosaws.asg.actions
Namefail_az
Returnmapping

This function simulates the loss of an AZ in an AWS Region for AutoScalingGroups by removing subnets of the AZ in the ASGs or update its min, max and desired capacity to 0 if it’s only configured for scaling in a single AZ. It also suspends the process of AZ Rebalancing of the ASG.

Conflicts with eks.fail_az: ensure that ASGs that belong to EKS clusters are not be tagged as they will be captured by this action, which will cause eks fail_az to not be able to identify the worker nodes.

Usage

JSON

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

YAML

name: fail_az
provider:
  arguments:
    az: ""
    dry_run: true
  func: fail_az
  module: azchaosaws.asg.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
dry_runboolfalseNoDry RunOnly perform a dry run for it

Return structure

{
  "AvailabilityZone": str,
  "DryRun": bool,
  "AutoScalingGroups": [
    {
      "AutoScalingGroupName": str,
      "Before": {
        "SubnetIds": List[str],
        "AZRebalance": bool,
        "MinSize": int,
        "MaxSize": int,
        "DesiredCapacity": int
      },
      "After": {
        "SubnetIds": List[str],
        "AZRebalance": bool,
        "MinSize": int,
        "MaxSize": int,
        "DesiredCapacity": int
      }
    }
    ...
  ]
}

Signature

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