-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
135 lines (121 loc) · 4.01 KB
/
serverless.yml
File metadata and controls
135 lines (121 loc) · 4.01 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
useDotenv: true
service: serverless-python311-template
frameworkVersion: "3"
plugins:
- serverless-offline
- serverless-python-requirements
- serverless-prune-plugin
- serverless-ignore
- serverless-deployment-bucket
- serverless-plugin-tracing
- serverless-dotenv-plugin
custom:
default:
stage: dev
# Serverless offline plugin
# LINK ref: https://www.serverless.com/plugins/serverless-offline
serverless-offline:
httpPort: 3333
noPrependStageInUrl: false
# Serverless Prune Plugin
# LINK: ref: https://www.serverless.com/plugins/serverless-prune-plugin
prune:
automatic: true
number: 3
# Serverless Deployment Bucket Plugin
# LINK: ref: https://www.serverless.com/plugins/serverless-deployment-bucket
deploymentBucket:
versioning: true
accelerate: true
blockPublicAccess: true
tags:
- Key: Environment
Value: ${self.stage}
# Versioning Deployed Functions
# LINK: https://www.serverless.com/framework/docs/providers/aws/guide/functions#versioning-deployed-functions
versionFunctions: false
# Serverless Python Requirements Plugin
# LINK ref: https://www.serverless.com/plugins/serverless-python-requirements
pythonRequirements:
dockerizePip: true
dockerSsh: true
usePoetry: true
slim: true
noDeploy:
- pytest
- boto3
- black
- mypy
- isort
- pytest-mock
- pytest-cov
- taskipy
- ruff
- alembic
- tox
- pdf2image
- ipykernel
provider:
name: aws
# Default stage (default: dev)
stage: ${opt:stage, self:custom.default.stage}
# Default region (default: us-east-1)
region: ap-northeast-1
# x-ray tracing
tracing:
lambda: true
apiGateway: true
# NOTE: Lambda Runtime Configuration
# Lambda configuration
runtime: python3.11
runtimeManagement: auto
# Processor architecture: 'x86_64' or 'arm64' via Graviton2 (default: x86_64)
architecture: x86_64
# Default memory size for functions (default: 1024MB)
memorySize: 4096
# Default timeout for functions (default: 6 seconds)
# Note: API Gateway has a maximum timeout of 30 seconds
timeout: 30
# Serverless Deployment Bucket Plugin
# LINK ref: https://www.serverless.com/plugins/serverless-deployment-bucket
deploymentBucket:
name: ${self.service}-deployment-bucket-${opt:stage}
serverSideEncryption: AES256
environment:
STAGE: ${opt:stage, self:custom.default.stage}
# API setting
API_VERSION_HASH: ${env:API_VERSION_HASH, "latest"}
API_BASE_URL: ${file(./env/${opt:stage, self:custom.default.stage}.yml):API_BASE_URL}
API_CORS_ALLOWED_ORIGINS: ${file(./env/${opt:stage, self:custom.default.stage}.yml):API_CORS_ALLOWED_ORIGINS}
# lambda powertools settings
POWERTOOLS_LOG_LEVEL: ${file(./env/${opt:stage, self:custom.default.stage}.yml):POWERTOOLS_LOG_LEVEL}
POWERTOOLS_SERVICE_NAME: ${file(./env/${opt:stage, self:custom.default.stage}.yml):POWERTOOLS_SERVICE_NAME}
POWERTOOLS_DEV: ${file(./env/${opt:stage, self:custom.default.stage}.yml):POWERTOOLS_DEV}
POWERTOOLS_DEBUG: ${file(./env/${opt:stage, self:custom.default.stage}.yml):POWERTOOLS_DEBUG}
POWERTOOLS_TRACE_MIDDLEWARES: ${file(./env/${opt:stage, self:custom.default.stage}.yml):POWERTOOLS_TRACE_MIDDLEWARES}
POWERTOOLS_TRACE_DISABLED: ${file(./env/${opt:stage, self:custom.default.stage}.yml):POWERTOOLS_TRACE_DISABLED}
package:
individually: true
# package.json devDependencies are not included in the deployment package
excludeDevDependencies: true
exclude:
- ./**
include:
- ./src/**
functions:
ApplicationApiHandlerV1:
description: Application API Handler V1
handler: src/v1/handlers/app.lambda_handler
events:
- http:
path: /v1/{proxy+}
method: ANY
cors: true
ApplicationApiSwaggerHostingHandlerV1:
description: Application API Swagger Document Hosting Handler V1
handler: src/v1/handlers/app.lambda_handler
events:
- http:
path: /v1/swagger
method: get
cors: true