This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
97 lines (92 loc) · 3.09 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
service: housing-collab-api
provider:
name: aws
runtime: nodejs16.x
vpc: ${self:custom.vpc.${opt:stage}}
stage: ${opt:stage}
region: eu-west-2
functions:
api:
handler: index.universal
role: lambdaExecutionRole
environment:
CLICKSEND_API_KEY: ${ssm:/housing-collab-api/${self:provider.stage}/clicksend-api-key}
CLICKSEND_USERNAME: ${ssm:/housing-collab-api/${self:provider.stage}/clicksend-username}
DATABASE_URL: ${ssm:/housing-collab-api/${self:provider.stage}/database-url}
EMAIL_ADDRESS_ID: ${ssm:/housing-collab-api/${self:provider.stage}/email-address-id}
HEROKU_POSTGRESQL_CRIMSON_URL: ${ssm:/housing-collab-api/${self:provider.stage}/database-url}
JWT_SECRET: ${ssm:/housing-collab-api/${self:provider.stage}/jwt-secret}
SMS_NUMBER: ${ssm:/housing-collab-api/${self:provider.stage}/sms-number}
UI_URL: ${ssm:/housing-collab-api/${self:provider.stage}/ui-url}
events:
- http:
path: /
method: ANY
- http:
path: /{proxy+}
method: ANY
resources:
Resources:
lambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
Path: /${self:service}/${self:provider.stage}/
RoleName: ${self:service}-lambdaExecutionRole
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole
Policies:
- PolicyName: manageLogs
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- 'Fn::Join':
- ':'
- - 'arn:aws:logs'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'log-group:/aws/lambda/*:*:*'
- Effect: 'Allow'
Action:
- 's3:PutObject'
- 's3:GetObject'
Resource:
Fn::Join:
- ''
- - 'arn:aws:s3:::'
- 'Ref': 'ServerlessDeploymentBucket'
- PolicyName: lambdaInvocation
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- 'lambda:InvokeFunction'
Resource: '*'
custom:
vpc:
development:
securityGroupIds:
- sg-061dddb0a7fc34d1a
subnetIds:
- subnet-01f5294cc9f85669e
- subnet-0d34c8d6fc16a0364
production:
securityGroupIds:
- sg-0e3ca1352f142d8c8
subnetIds:
- subnet-01d3657f97a243261
- subnet-0b7b8fea07efabf34