Skip to content

Instantly share code, notes, and snippets.

@lbjay
Created July 11, 2018 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbjay/e22d4e983f9ce8b01a4825b11be6d698 to your computer and use it in GitHub Desktop.
Save lbjay/e22d4e983f9ce8b01a4825b11be6d698 to your computer and use it in GitHub Desktop.
sns for catracker
Add a `.env` variable, `NOTIFICATION_EMAIL`
Then update the `run_stack_command` fabric task to pass that to cloudformattion as `NotificationEmail`.
# then in template.yml
Parameters:
...
NotificationEmail:
Type: String
Resources:
...
CATrackerNotificationTopic:
Type: AWS::SNS::Topic
Properties:
TopicName: !Sub "${AWS::StackName}-notification-topic"
Subscription:
- Protocol: email
Endpoint: !Ref NotificationEmail
Outputs:
...
SNSTopicArn:
Description: CATracker SNS Arn
Value: !Ref CATrackerNotificationTopic
OK, now that the SNS topic is in the stack outputs you'll be able to get it via the `stack_exports` return value
in the fabric tasks and add it to the remote app's `.env` in the same way the "RDSEndpoint" and "ELBEndpoint" get
used in the `app_configure` task.
The check out the `publish` method in the SNS boto3 docs
http://boto3.readthedocs.io/en/latest/reference/services/sns.html#client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment