NOTE: If SNS topic and SQS queue are in different AWS accounts but the same region it is important for the "aws_sns_topic_subscription" to use the AWS provider of the account with the SQS queue. Stack B in another account with the lambda to subscribe to the above SNS topic.
AWS Lambda function to publish to SNS topic. Another way to think of it is that topics are like 4sysops.com.
To get started, we first need to set up a topic on AWS SNS. SNS topic exists in Account: A SQS queue exists in Account: B. GitHub Gist: instantly share code, notes, and snippets.
Description: Stack that creates a Lambda function and subscribes it to a SNS topic in another account. The existing policy on the topic … Additionally, bloggers can post or publish topics to 4sysops, which then the subscribers will receive notifications about. The arn of the topic is "arn:aws:sns:us-west-2:123456789:test1234".
In order to do that we attach a policy to the topic which allows our bucket resource to perform the SNS:Publish action on the topic. In order to subscribe, i first need to add permissions into the topic's policy so that the queue can subscribe..
Trying to subscribe an SQS queue in account B to get msgs from the SNS topic in account A. To continue, you will need all the necessary tokens from your AWS account.
In case you don't have multiple subscribers on your SNS topic you may also directly notify SQS from S3 and skip SNS inbetween. 4sysops creates content, and a visitor can subscribe to or follow certain authors or content types. This kind of thing isn’t well documented, IMHO, so getting this all straight and functioning smoothly can be a little confusing. – angled Feb 12 '18 at 7:57 A topic is what we would consider a 'publisher' - we can send messages to a topic, which it will then publish to all of its subscribers.
Now when you want to do something like invoking a Lambda function in another account/region via an SNS topic through a custom resource in AWS CloudFormation, it should work like a charm! I also tried the equivalent using the AWS CLI - sns create-topic, sqs create-queue, sqs get-queue-attributes to get the queue arn, sns subscribe, sns publish, sqs receive-message; unfortunately, there is no message in the queue. At your AWS dashboard, select 'Simple Notification Service' and hit 'Topics' on the left hand side, followed by the 'Create topic' button. –Steve . I hope this post saved you some head-scratching! AWS.