【发布时间】:2019-05-17 22:32:02
【问题描述】:
我想知道如何强制本地无服务器部署模仿我将其部署到 AWS 时发生的情况。
这是我的无服务器 yaml 文件:
service: payment # NOTE: update this with your service 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"
environment:
SLS_DEBUG: "*"
provider:
name: aws
runtime: nodejs8.10
stage: production
region: ca-central-1
timeout: 60
role: ${file(../config/prod.env.json):ROLE}
vpc:
securityGroupIds:
- ${file(../config/prod.env.json):SECURITY_GROUP}
subnetIds:
- ${file(../config/prod.env.json):SUBNET}
apiGateway:
apiKeySourceType: HEADER
apiKeys:
- ${file(../config/prod.env.json):APIKEY}
package:
include:
- ../lib/**
functions:
- '${file(src/handlers/payment.serverless.yml)}'
plugins:
- serverless-offline
我的文件结构如下:
root
--- node_modules
--- lib
- models
--- payment
- serverless.yml
当我将它部署到 AWS 时,lib 文件夹会被放入 lambda 函数的文件夹中,但在本地我需要定义它的路径,通常是 ../.../../
我怎样才能使它在本地或部署时不必更改路径?
【问题讨论】:
标签: amazon-web-services aws-lambda serverless-framework serverless