-
Notifications
You must be signed in to change notification settings - Fork 2
/
serverless.yml
54 lines (48 loc) · 1.73 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
service: lambda-mailer # NOTE: update this with your service name
plugins:
- serverless-offline-sns
- serverless-offline
- serverless-pseudo-parameters
custom:
stage: ${opt:stage, 'dev'}
bucketName: ${self:service}-${self:provider.stage}-deploy # build bucket name with stage
topicName: ${self:service}-sns-mail-notification-${self:custom.stage}
topicArn: arn:aws:sns:${self:provider.region}:#{AWS::AccountId}:${self:custom.topicName}
emailFrom: "YourCompanyName <[email protected]>"
region: us-west-2
nodeEnv:
dev: development
other: production
serverless-offline-sns:
port: 4002
debug: true
sns-endpoint: http://127.0.0.1:4002 # Optional. Only if you want to use a custom endpoint
provider:
name: aws
runtime: nodejs10.x
region: ${self:custom.region} # using same region for SNS and Lambda Function
versionFunctions: false
stage: ${self:custom.stage}
environment: # Service wide environment variables
TOPIC_NAME: ${self:custom.topicName}
S3_BUCKET: bucket-to-store-email-images
EMAIL_FROM: ${self:custom.emailFrom}
NODE_ENV: ${self:custom.nodeEnv.${self:provider.stage}, self:custom.nodeEnv.other}
iamRoleStatements:
- Effect: "Allow"
Action:
- "ses:*"
Resource: "*"
- Effect: "Allow"
Action: "s3:*"
Resource: "*"
functions:
mailerFn:
handler: index.handler
memorySize: 256 # optional, in MB, default is 1024
timeout: 20 # optional, in seconds, default is 6
events:
- sns: ${self:custom.topicName}
onError: arn:aws:sns:#{AWS::Region}:#{AWS::AccountId}:errors-topic
environment:
TOPIC_ARN: { "Fn::Join": ["", ["arn:aws:sns:${self:custom.region}:", { "Ref": "AWS::AccountId" }, ":${self:custom.topicArn}" ] ] }