Skip to content

Instantly share code, notes, and snippets.

@joawan
Created August 25, 2021 14:27
Show Gist options
  • Save joawan/9d79c5d9c0ec40e74991da513086d960 to your computer and use it in GitHub Desktop.
Save joawan/9d79c5d9c0ec40e74991da513086d960 to your computer and use it in GitHub Desktop.
AWS SAM for SES event pipeline
EventsSNS:
Type: AWS::SNS::Topic
Properties:
TopicName: sam-pigeon-events
Subscription:
- Endpoint: !GetAtt EventsQueue.Arn
Protocol: sqs
EventsQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: sam-pigeon-events
EventsQueuePolicy:
Type: AWS::SQS::QueuePolicy
Properties:
Queues:
- !Ref EventsQueue
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- sqs:SendMessage
Resource: !GetAtt EventsQueue.Arn
Principal: '*'
Condition:
ArnEquals:
aws:SourceArn: !Ref EventsSNS
IngestEventLambda:
Type: AWS::Serverless::Function
Properties:
CodeUri: src/ingest-event/
Description: Polls SQS, forwards event
Policies:
- SQSPollerPolicy:
QueueName: !GetAtt EventsQueue.QueueName
Events:
SQSEvent:
Type: SQS
Properties:
BatchSize: 10
Queue: !GetAtt EventsQueue.Arn
Environment:
Variables:
STAGE: !Ref Stage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment