actionEC2

terminate_instances

Terminates multiple EC2 instances

Activity as code

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

Typeaction
Modulechaosaws.ec2.actions
Nameterminate_instances
Returnlist

Usage

JSON

{
  "name": "terminate-instances",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosaws.ec2.actions",
    "func": "terminate_instances"
  }
}

YAML

name: terminate-instances
provider:
  func: terminate_instances
  module: chaosaws.ec2.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
instance_idslistnullNoInstance IDsList of instance identifiers, or filters below
filterslistnullNoInstance FiltersList of key/value pairs to select instances
azstringnullNoAvailability ZoneAvailability zone to target. If the other fields are left empty, all instances in this AZ will be terminated

A set of instances may be targeted by providing them as the instance-ids.

WARNING: If only an Availability Zone is specified, all instances in that AZ will be terminated.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature

def terminate_instances(
        instance_ids: List[str] = None,
        az: str = None,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass