airflow.providers.amazon.aws.secrets.systems_manager

Objects relating to sourcing connections from AWS SSM Parameter Store

Module Contents

Classes

SystemsManagerParameterStoreBackend

Retrieves Connection or Variables from AWS SSM Parameter Store

class airflow.providers.amazon.aws.secrets.systems_manager.SystemsManagerParameterStoreBackend(connections_prefix='/airflow/connections', variables_prefix='/airflow/variables', config_prefix='/airflow/config', **kwargs)[source]

Bases: airflow.secrets.BaseSecretsBackend, airflow.utils.log.logging_mixin.LoggingMixin

Retrieves Connection or Variables from AWS SSM Parameter Store

Configurable via airflow.cfg like so:

[secrets]
backend = airflow.providers.amazon.aws.secrets.systems_manager.SystemsManagerParameterStoreBackend
backend_kwargs = {"connections_prefix": "/airflow/connections", "profile_name": null}

For example, if ssm path is /airflow/connections/smtp_default, this would be accessible if you provide {"connections_prefix": "/airflow/connections"} and request conn_id smtp_default. And if ssm path is /airflow/variables/hello, this would be accessible if you provide {"variables_prefix": "/airflow/variables"} and request conn_id hello.

Parameters
  • connections_prefix (str) – Specifies the prefix of the secret to read to get Connections. If set to None (null), requests for connections will not be sent to AWS SSM Parameter Store.

  • variables_prefix (str) – Specifies the prefix of the secret to read to get Variables. If set to None (null), requests for variables will not be sent to AWS SSM Parameter Store.

  • config_prefix (str) – Specifies the prefix of the secret to read to get Variables. If set to None (null), requests for configurations will not be sent to AWS SSM Parameter Store.

You can also pass additional keyword arguments listed in AWS Connection Extra config to this class, and they would be used for establish connection and passed on to Boto3 client.

[secrets]
backend = airflow.providers.amazon.aws.secrets.systems_manager.SystemsManagerParameterStoreBackend
backend_kwargs = {"connections_prefix": "airflow/connections", "region_name": "eu-west-1"}
client()[source]

Create a SSM client

get_conn_value(conn_id)[source]

Get param value

Parameters

conn_id (str) – connection id

get_conn_uri(conn_id)[source]

Return URI representation of Connection conn_id.

As of Airflow version 2.3.0 this method is deprecated.

Parameters

conn_id (str) – the connection id

get_variable(key)[source]

Get Airflow Variable from Environment Variable

Parameters

key (str) – Variable Key

Returns

Variable Value

Return type

str | None

get_config(key)[source]

Get Airflow Configuration

Parameters

key (str) – Configuration Option Key

Returns

Configuration Option Value

Return type

str | None

Was this entry helpful?