-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
65 lines (57 loc) · 1.34 KB
/
serverless.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
service: aws-node-sqs-worker
frameworkVersion: "2.53"
plugins:
- serverless-offline
- serverless-offline-sqs
provider:
name: aws
runtime: nodejs14.x
stage: ${opt:stage, 'local'}
region: ${opt:region, 'us-east-1'}
lambdaHashingVersion: 20201221
environment: ${file(./env/${self:provider.stage}.yml)}
iam:
role:
statements:
- Effect: Allow
Action:
- "sqs:SendMessage"
- "sqs:ReceiveMessage"
Resource:
- Fn::GetAtt: [myQueue, Arn]
custom:
serverless-offline-sqs:
autoCreate: true
apiVersion: "2012-11-05"
endpoint: ${self:provider.environment.ELASTICMQ_URL}
region: ${self:provider.region}
accessKeyId: ${self:provider.environment.ACCESS_KEY_ID}
secretAccessKey: ${self:provider.environment.SECRET_ACCESS_KEY}
skipCacheInvalidation: false
functions:
producer:
handler: handler.producer
events:
- http:
method: post
path: produce
consumer:
handler: handler.consumer
events:
- sqs:
arn:
Fn::GetAtt:
- myQueue
- Arn
listQueues:
handler: handler.listQueues
events:
- http:
method: get
path: queues
resources:
Resources:
myQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: myQueue