I want to recreate a deleted Amazon SNS topic subscription for an Amazon SQS queue in another AWS account.
If you call the Amazon SNS Unsubscribe API from an account that doesn't own the subscription, the subscription enters Deleted status for 72 hours. While the SNS topic subscription is in Deleted status, the account that owns the subscription can't resubscribe the same endpoint to the topic.
After 72 hours, Amazon SNS clears the Deleted subscription and the account that owns the subscription can resubscribe the same endpoint to the topic.
If you don't want to wait 72 hours to resubscribe, you can manually recreate the subscription by doing any of the following.
Note: It's a best practice to run Subscribe and Unsubscribe API calls from the same AWS account. When you call the Subscribe API, the AWS account that you use to make the call becomes the subscription owner.
Resolution
Important: The following procedures apply to HTTP and HTTPS endpoint subscribers. It doesn't apply to AWS Lambda function subscribers.
Send an HTTP GET method request to the SubscribeURL in the UnsubscribeConfirmation message that you received
-
In the UnsubscribeConfirmation message sent to the SQS queue after you deleted the subscription, find the SubscribeURL. Then, copy and paste the URL to a text document.
-
Send an HTTP GET method request to the SubscribeURL.
HTTP GET method request example
curl -X GET "https://sns.us-west-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-west-2:123456789012:MyTopic&Token=<token>"
Call the Amazon SNS Subscribe API from the AWS account that owns the SNS topic, then confirm the subscription
- Call the Amazon SNS Subscribe API from the AWS account that owns the SNS topic.
- Have an AWS user with permissions to read messages from the SQS queue confirm the subscription.
Create a new Amazon SNS topic to replace the current topic, then subscribe to the new topic
- Create a new SNS topic to replace the current topic.
- Subscribe the SQS queue to the new topic.
Related information
Deleting an Amazon SNS subscription and topic
Sending Amazon SNS messages to an Amazon SQS queue in a different account
Fanout to Amazon SQS queues