所以,我遇到了很多线索,但没有一个能解决我的问题。我正在尝试使用现有的 DEV-Stage 将 Lambda 函数部署到现有的 RestApi。我的 API 是这样构建的:
this.RestAPIDev = new gw.RestApi(this, 'StagingGatewayDev', {
restApiName: 'gateway-DEV',
deploy: true,
deployOptions: {
stageName: 'DEV',
description: 'DEV Stage',
variables: { ALIAS: 'DEV' },
}
});
Run Code Online (Sandbox Code Playgroud)
Lambda Stack 独立于其自己的存储库中,包括管道和 lambda 代码。我尝试通过添加资源和方法将这些 Lambda 函数部署到此现有网关,并假设因为我在deploy:true网关上设置,所以它将自行部署。这是 Lambda 堆栈:
const restApi = gw.RestApi.fromRestApiAttributes(this, 'RestApi', {
restApiId: props.restApiId,
rootResourceId: props.restApiRoot,
});
const authenticate = new lambda.Function(this, 'AuthenticateFunction', {
code: this.lambdaCode, // is a property
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'src/api/authenticate.handler',
description: 'API: Authenticates the token',
role: <executionRole>, // is …Run Code Online (Sandbox Code Playgroud)