-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
90 lines (82 loc) · 2.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
service: MonteCarloVisualization
provider:
name: aws
runtime: python3.7
stage: dev
region: eu-west-2
# you can add statements to the Lambda function's IAM Role here
# iamRoleStatements:
# - Effect: "Allow"
# Action:
# - "s3:ListBucket"
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
# - Effect: "Allow"
# Action:
# - "s3:PutObject"
# Resource:
# Fn::Join:
# - ""
# - - "arn:aws:s3:::"
# - "Ref" : "ServerlessDeploymentBucket"
# - "/*"
# you can define service wide environment variables here
# environment:
# variable1: value1
custom:
functionsBasePath: BE/src
s3Sync:
- bucketName: montecarlovisualization
localDir: UI
acl: public-read # optional
defaultContentType: text/html # optional
params:
- index.html:
CacheControl: 'no-cache'
- "*.js":
CacheControl: 'public, max-age=31536000'
package:
include:
- src/**
exclude:
- tests/**
- requirements.txt
- BE/venv37/**
- BE/node_modules/**
- node_modules/**
functions:
main:
handler: handler.hello
role: lambdaNoAccessRole
layers:
- arn:aws:lambda:eu-west-2:142628438157:layer:AWSLambda-Python37-SciPy1x:2
events:
- http:
path: visualize
method: POST
cors: true
resources:
Resources:
SiteBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: montecarlovisualization
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: error.html
lambdaNoAccessRole:
Type: AWS::IAM::Role
Properties:
Path: /montecarlo/
RoleName: MonteCarloLambda
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action: sts:AssumeRole
plugins:
- serverless-s3-sync
- serverless-functions-base-path