15

I regularly spin up and spin down elastic beanstalk environments which have my team's email set as the notification address. Is there a way I can automatically confirm subscription to all of the SNS topics that are created instead of having to manually click a link in an email every time (and miss a few)?

thefroatgt
  • 896
  • 2
  • 12
  • 19
  • In the token parameter of ConfirmSubscription API , can we send any string as token value or do we need to send something specific ? – Subham Tripathi Apr 20 '15 at 03:43

3 Answers3

0

It seems you are programmatically creating environments. You may consider automatically confirming subscriptions using the SNS ConfirmSubscription API

http://docs.aws.amazon.com/sns/latest/APIReference/API_ConfirmSubscription.html

Also another option is to create your own topic and subscribe your email to it. Then reuse the topic for all your environments using the "Notification Topic ARN" option setting instead of providing an email address when launching a new beanstalk environment. That way you subscribe the topic once and then forget about it.

Rohit Banga
  • 18,458
  • 31
  • 113
  • 191
  • In the `token` parameter of `ConfirmSubscription` API , can we send any string as token value or do we need to send something specific ? – Subham Tripathi Apr 20 '15 at 03:43
  • When you subscribe an endpoint the subscription message received by the endpoint (email, sqs) will contain the token to be used. You cannot use anything. – Rohit Banga Apr 20 '15 at 03:49
  • i provide json as input to the command using --cli-input-json . in that json i need to provide value for the key `token` if i do not give any value then it gives me error , if i delete that key from the json then again i get error. so what to provide as token ? – Subham Tripathi Apr 20 '15 at 03:55
  • What is your endpoint type? The subscription message will tell you the token. – Rohit Banga Apr 20 '15 at 03:56
  • my end point type is email. i got this mail for confirmation `You have chosen to subscribe to the topic: arn:aws:sns:us-east-1:132895064974:TestTopic` , how to find token from it ? – Subham Tripathi Apr 20 '15 at 04:11
  • Use email-json instead of email. Then the token will be visible. Just email is for manual subscriptions through clicking the link. – Rohit Banga Apr 20 '15 at 04:14
  • ok , so what u are effectively saying is i should provide email json as an endpoint to the subscription and then it will return some token that i can use to auto confirm my subscription , am i correct ? i will check it and let you know .. thanx – Subham Tripathi Apr 20 '15 at 04:18
  • @SubhamTripathi Can you able to retrieve that token ? i know this comment is long back :) thought it may give me any help – Private Mar 21 '19 at 13:01
0

There is no good way that I know of to do this. The easiest way I can think of would be instead of subscribing an email to the topic, subscribe an SQS queue, and then have a separate process reading from that SQS queue and sending emails to your team email address. It's not pretty, but it will work, and you won't lose any messages.

tster
  • 17,883
  • 5
  • 53
  • 72
0

There is no need to create a new SNS topic for each environment.

For example, when configuring notifications using configuration options, using this option:

Notification Topic ARN – [...] You can also set this option to use an existing SNS topic for notifications. A topic that you attach to your environment by using this option is not deleted when you change this option or terminate the environment.

Then for each new environment the mailing-list is only receiving this type of e-mail for which there is no need to confirm subscription:

This is a publish notification test for environment 'your-new-environment-name', to verify permissions to attach an SNS topic to the environment.

-- If you wish to stop receiving notifications from this topic, please click or visit the link below to unsubscribe: https://sns.eu-west-1.amazonaws.com/unsubscribe.html?some_key..

pba
  • 700
  • 8
  • 18