actionASG

terminate_random_instances

Terminates one or more random healthy instances associated to an ALB

Activity as code

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

Typeaction
Modulechaosaws.asg.actions
Nameterminate_random_instances
Returnlist

A healthy instance is considered one with a status of ‘InService’.

Usage

JSON

{
  "name": "terminate-random-instances",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosaws.asg.actions",
    "func": "terminate_random_instances"
  }
}

YAML

name: terminate-random-instances
provider:
  func: terminate_random_instances
  module: chaosaws.asg.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
asg_nameslistnullNoASG NamesOne or many ASG names as a JSON encoded list
tagslistnullNoASG TagsList of AWS tags for to identify ASG by tags instead of by names
instance_countintegernullNoNumber of Instances to DeatchThe amount of instances to terminate, or set the percentage below
instance_percentintegernullNoPercentage of Instances to DeatchThe percentage of instances to terminate, or set the number above or the availability zone below
azstringnullNoAvailability-ZoneSpecificy the availability zone to select ASG from

One of:

One of:

tags are expected as a list of dictionary objects:

[
    {'Key': 'TagKey1', 'Value': 'TagValue1'},
    {'Key': 'TagKey2', 'Value': 'TagValue2'},
    ...
]

Signature

def terminate_random_instances(
        asg_names: List[str] = None,
        tags: List[Dict[str, str]] = None,
        instance_count: int = None,
        instance_percent: int = None,
        az: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass