actionEC2

stop_instances

Stop the given EC2 instances or, if none is provided, all instances of the given availability zone

Activity as code

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

Typeaction
Modulechaosaws.ec2.actions
Namestop_instance
Returnlist

Usage

JSON

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

YAML

name: stop-instances
provider:
  func: stop_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 stopped
forcebooleanfalseNoForceForce the operation

If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature

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