使用CDK将ApiGateway连接到lambda,我们首先创建一个RestApi(),然后创建一个LambdaIntegration来将Apigateway连接到lambda。How to point ApiGateway to a specific Lambda alias解释了如何在没有CDK的情况下将ApiG连接到Lambda别名。如何将其转换为CDK?我们的目标是将预置的并发和自动伸缩添加到与API网关一起使用的lambda。
在下面的CDK文件中,我只在两个端点中的一个上添加了一个Authorizer,但是当我启动一个请求时,这两个端点都是不受保护的,在函数日志中,您可以看到既没有UserPool也没有AuthenticationType文件:import * as lambda from '@aws-cdk/aws-lambdafrom '@aws-cdk
AWS引导状态下的命令:Deploys a CDKToolkit CloudFormation stack into the specified environment(s), that provides an S3 bucket that cdk deploy will use to store synthesized templates and the related$ # Deploys to all environments
$ cdk bootstrap --app='node bin