in src/proxysql.ts [166:188]
constructor(scope: Construct, id: string, props: ServerlessDemoProps) {
super(scope, id);
// our lambda function
const handler = new lambda.Function(this, 'LambdaFunc', {
code: lambda.Code.fromAsset('./lambda/hello_world'),
runtime: lambda.Runtime.PYTHON_3_7,
memorySize: 512,
timeout: Duration.seconds(60),
handler: 'app.lambda_handler',
vpc: props.vpc,
environment: {
PROXYSQL_HOST: `nlb.${PROXYSQL_PRIVATE_ZONE_NAME}`,
PROXYSQL_PORT: NLB_LISTENER_PORT ? NLB_LISTENER_PORT.toString() : '3306',
},
});
const api = new apigatewayv2.HttpApi(this, 'APIG', {
defaultIntegration: new integrations.HttpLambdaIntegration('integ', handler),
});
printOutput(this, 'APIGatewayURL', api.url!);
}