I have problems assigning my sqs queue the correct policy so that any sns topic can send a message to it whenever this queue gets subscribed to it. I tried to use UpdatePolicy and Metadata in serverless without any effect:
resources:
Resources:
DevNull:
Type: AWS::SQS::Queue
Properties:
QueueName: ${self:custom.serviceName}-${self:provider.stage}-dev-null-queue
UpdatePolicy:
policy:
statement:
- Effect: Allow
Principal:
Service: sns.amazonaws.com
Action: sqs:SendMessage
Resource: '*'
Metadata:
AWS::CloudFormation::CustomResource:
policyStatements:
- Effect: Allow
Principal:
Service: sns.amazonaws.com
Action:
- 'sqs:SendMessage'
Resource: '*'
I also can not see any changes in the "Access policy(Permission)" tab in the aws console after deployment. I subscribed an email address to double check if the messages are sent and I get them all via email but there is none in the sqs.
I found a SAM template which does what I need but I have no idea how to write this with the serverless framework and I can not find any documentation on this.