0

I have an SQS Queue that is subscribed to an SNS Topic and everythning is working as expected. Since I am using Cloudformation for infrastructure provisioning, a few years ago, AWS didn't support RawMessageDelivery via cloudformation, therefore, I had to use a custom resource (lambda) for subscribing our SQS queue to SNS Topic with RawMessageDelivery activated.

Now, cloudformation AWS::SQS::Subscription supports RawMessageDelivery and we can remove the custom resources (lambdas) being used for SNS subscription and use the script below in the template.

MyQueueSubscription:
    Type: 'AWS::SNS::Subscription'
    Properties:
      TopicArn: !Ref TopicArn 
      Endpoint: !GetAtt 
        - AbcdEventQueue
        - Arn
      Protocol: sqs
      RawMessageDelivery: 'true'

Now the problem is that custom resource (lambda) that is doing the subscription currently is a separate AWS Stack and if I remove this stack, it will also delete the SQS subscription. Although, I can quickly sync the Queue stack with the code above, however, there's a possibility of losing some messages in this case.

What is the best approach to updating the subscription/stack without losing any messages from the SNS topic to my queue?

ihaider
  • 1,290
  • 4
  • 19
  • 38

0 Answers0