I am trying to delete a subscription to an SNS topic (specifically an email address) that is unconfirmed, but the AWS console won't let me. It will let me delete subscriptions that are confirmed however. Any ideas?
5 Answers
According to SNS architecture and design:
If subscription is APPROVED so no matter whether there is topic associated to it or not. User will be able to delete the subscription.)
If subscription is PENDING so no matter whether there is topic associated to it or not. Amazon will delete automatically the subscription after 3 days of creation.
See the FAQ for more info (scroll down to the question titled "How long will subscription requests remain pending, while waiting to be confirmed?")
I have seen email subscriptions hanging around indefinitely in the PendingConfirmation state and as you mention, they can't be deleted using the web console. Also, after a few days the link in the subscription confirmation email expires, so you can't click to confirm the subscription and then delete it either.
However, assuming you still have access to the email address, you can create a new subscription in the web console for the SNS topic using the same email address. This doesn't actually result in a separate subscription as it seems that an email address can only be subscribed once. However, it does send another email with a new confirmation link which you can click to confirm the subscription. Once it's confirmed, you can finally delete the subscription in the SNS web console.
I had the problem with an unconfirmed SQS subscription. When deleting the pending subscription, resubscribing the queue resulted in the awkward state that it was subscribed with the deleted pending subscription so no messages would be delivered.
I fixed that by setting up a subscription in the topic's account which triggered a new confirmation message to be send. Once the subscription was confirmed (manually), it replaced the deleted pending subscription and the queue received messages again. Also, the subscription could be fully removed without the deleted pending subscription reappearing.
No idea if a similar approach would work for email subscriptions.