-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
47 lines (47 loc) · 1.44 KB
/
template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Processes charges for advertisers based on events put into queue
Parameters:
MongoUri:
Type: AWS::SSM::Parameter::Value<String>
Default: '/api/db/mongo_uri'
StripeSecretKey:
Type: AWS::SSM::Parameter::Value<String>
Default: '/api/stripe/secret_key'
Resources:
ProcessAdvertiserTransactionsDeadLetterQueue:
Type: AWS::SQS::Queue
ProcessAdvertiserTransactionsQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: process-advertiser-transactions-input
RedrivePolicy:
deadLetterTargetArn: !GetAtt ProcessAdvertiserTransactionsDeadLetterQueue.Arn
maxReceiveCount: 3
VisibilityTimeout: 240
ProcessAdvertiserTransactionsFunction:
Type: AWS::Serverless::Function
Properties:
Timeout: 180
Handler: index.handler
Runtime: nodejs10.x
CodeUri: ./
Events:
ProcessAdvertiserTransactionsEvent:
Type: SQS
Properties:
Queue: !GetAtt ProcessAdvertiserTransactionsQueue.Arn
BatchSize: 1
Policies:
- AmazonDynamoDBFullAccess
- AmazonSQSFullAccess
- Statement:
- Effect: Allow
Action:
- 'kms:Decrypt'
- 'kms:ListKeys'
Resource: '*'
Environment:
Variables:
MONGO_URI: !Ref MongoUri
STRIPE_SECRET_KEY: !Ref StripeSecretKey