-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
103 lines (93 loc) · 2.56 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
service: serverless-effortless
# app and org for use with dashboard.serverless.com
#app: your-app-name
#org: your-org-name
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
provider:
name: aws
runtime: python3.6
region: ${opt:region, 'us-west-2'}
stage: ${opt:stage, self:custom.defaultStage}
profile: ${self:custom.profiles.${self:provider.stage}}
# Memory allocated in lambda functions
memorySize: 512
logRetentionInDays: 30
environment:
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
MARKETING_S3_BUCKET: ${self:custom.marketing_s3}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:*
Resource: ${self:custom.dynamodb_resource}
- Effect: Allow
Action:
- s3:*
Resource: ${self:custom.marketing_s3_role_resource}
custom:
defaultStage: dev
pythonRequirements:
dockerizePip: true
profiles:
dev: serverless-effortless-dev
dynamodb_table: ${self:service}-${opt:stage, self:provider.stage}
dynamodb_resource: "arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.dynamodb_table}"
marketing_s3: newsletter-marketing
marketing_s3_bucket_arn: arn:aws:s3:::${self:custom.marketing_s3}
marketing_s3_role_resource: ${self:custom.marketing_s3_bucket_arn}/*
dotenv:
basePath: config/
functions:
hello:
handler: serverless.handler.hello
events:
- http:
path: hello
method: get
subscribe:
handler: serverless.handler.subscribe
events:
- http:
path: subscribe
method: post
unsubscribe:
handler: serverless.handler.unsubscribe
events:
- http:
path: unsubscribe
method: delete
send_email:
handler: serverless.handler.send_email
events:
- s3:
bucket: ${self:custom.marketing_s3}
event: s3:ObjectCreated:*
plugins:
- serverless-dotenv-plugin
package:
exclude:
- ./**
include:
- serverless/**
- '!serverless/.pytest_cache/**'
- '!serverless/tests/**'
resources:
Resources:
NewsLetterDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: email
AttributeType: S
KeySchema:
-
AttributeName: email
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE}