Amazon Simple Notification Service (SNS)¶
Amazon Simple Notification Service (Amazon SNS) is a managed service that provides message delivery from publishers to subscribers (also known as producers and consumers). Publishers communicate asynchronously with subscribers by sending messages to a topic, which is a logical access point and communication channel. Clients can subscribe to the SNS topic and receive published messages using a supported endpoint type, such as Amazon Kinesis Data Firehose, Amazon SQS, AWS Lambda, HTTP, email, mobile push notifications, and mobile text messages (SMS).
Prerequisite Tasks¶
To use these operators, you must do a few things:
Create necessary resources using AWS Console or AWS CLI.
Install API libraries via pip.
pip install 'apache-airflow[amazon]'
Detailed information is available Installation
Operators¶
Publish a message to an existing SNS topic¶
To publish a message to an Amazon SNS Topic you can use
SnsPublishOperator
.
publish = SnsPublishOperator(
task_id='publish_message',
target_arn=SNS_TOPIC_ARN,
message='This is a sample message sent to SNS via an Apache Airflow DAG task.',
)