How to subscribe an SNS topic of one account by SQS of another account using boto3?


I’m trying to create an SNS topic in one account and attach it to Config Rules.
I have 3 such accounts and want to create SNS topic in each of the account.
Now i want to subscribe all of the 3 topics of 3 different accounts by SQS of the fourth account.

I’m able to do it manually. Can somebody please tell me how it can be done via boto3.

Thanks in Advance.


In order to subscribe a SNS topic present in Account A by an SQS present in Account B using boto3, following is the procedure.

In Account A, create SNS topic and add the proper permission.
For example,

Now to subscribe the created topic from Account B, execute the following code from account B.

Now you would see the SNS topic of account A been subscribed by account B.

Leave a Reply