Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

airflow.providers.amazon.aws.sensors.ssm

Classes

SsmRunCommandCompletedSensor

Poll the state of an AWS SSM Run Command until all instance jobs reach a terminal state. Fails if any instance job ends in a failed state.

Module Contents

class airflow.providers.amazon.aws.sensors.ssm.SsmRunCommandCompletedSensor(*, command_id, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poke_interval=120, max_retries=75, **kwargs)[source]

Bases: airflow.providers.amazon.aws.sensors.base_aws.AwsBaseSensor[airflow.providers.amazon.aws.hooks.ssm.SsmHook]

Poll the state of an AWS SSM Run Command until all instance jobs reach a terminal state. Fails if any instance job ends in a failed state.

See also

For more information on how to use this sensor, take a look at the guide: Wait for an Amazon SSM run command

Parameters:
  • command_id – The ID of the AWS SSM Run Command.

  • deferrable (bool) – If True, the sensor will operate in deferrable mode. This mode requires aiobotocore module to be installed. (default: False, but can be overridden in config file by setting default_deferrable to True)

  • poke_interval (int) – Polling period in seconds to check for the status of the job. (default: 120)

  • max_retries (int) – Number of times before returning the current state. (default: 75)

  • aws_conn_id – The Airflow connection used for AWS credentials. If this is None or empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).

  • region_name – AWS region_name. If not specified then the default boto3 behaviour is used.

  • verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

  • botocore_config – Configuration dictionary (key-values) for botocore client. See: https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html

INTERMEDIATE_STATES: tuple[str, Ellipsis] = ('Pending', 'Delayed', 'InProgress', 'Cancelling')[source]
FAILURE_STATES: tuple[str, Ellipsis] = ('Cancelled', 'TimedOut', 'Failed')[source]
SUCCESS_STATES: tuple[str, Ellipsis] = ('Success',)[source]
FAILURE_MESSAGE = 'SSM run command sensor failed.'[source]
aws_hook_class[source]
template_fields: collections.abc.Sequence[str][source]
command_id[source]
deferrable = True[source]
poke_interval = 120[source]
max_retries = 75[source]
poke(context)[source]

Override when deriving this class.

execute(context)[source]

Derive when creating an operator.

The main method to execute the task. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event=None)[source]

Was this entry helpful?