Package: aws-solutions-constructs.aws-apigateway-lambda
aws-apigateway-lambda module---Reference Documentation:https://docs.aws.amazon.com/solutions/latest/constructs/LanguagePackagePythonaws_solutions_constructs.aws_apigateway_lambdaTypescript@aws-solutions-constructs/aws-apigateway-lambdaJavasoftware.amazon.awsconstructs.services.apigatewaylambdaOverviewThis AWS Solutions Construct implements an Amazon API Gateway REST API connected to an AWS Lambda function pattern.Here is a minimal deployable pattern definition:Typescriptimport{Construct}from'constructs';import{Stack,StackProps}from'aws-cdk-lib';import{ApiGatewayToLambda}from'@aws-solutions-constructs/aws-apigateway-lambda';import*aslambdafrom'aws-cdk-lib/aws-lambda';newApiGatewayToLambda(this,'ApiGatewayToLambdaPattern',{lambdaFunctionProps:{runtime:lambda.Runtime.NODEJS_16_X,handler:'index.handler',code:lambda.Code.fromAsset(`lambda`)}});Pythonfromaws_solutions_constructs.aws_apigateway_lambdaimportApiGatewayToLambdafromaws_cdkimport(aws_lambdaas_lambda,Stack)fromconstructsimportConstructApiGatewayToLambda(self,'ApiGatewayToLambdaPattern',lambda_function_props=_lambda.FunctionProps(runtime=_lambda.Runtime.PYTHON_3_9,handler='index.handler',code=_lambda.Code.from_asset('lambda')))Javaimportsoftware.constructs.Construct;importsoftware.amazon.awscdk.Stack;importsoftware.amazon.awscdk.StackProps;importsoftware.amazon.awscdk.services.lambda.*;importsoftware.amazon.awscdk.services.lambda.Runtime;importsoftware.amazon.awsconstructs.services.apigatewaylambda.*;newApiGatewayToLambda(this,"ApiGatewayToLambdaPattern",newApiGatewayToLambdaProps.Builder().lambdaFunctionProps(newFunctionProps.Builder().runtime(Runtime.NODEJS_16_X).code(Code.fromAsset("lambda")).handler("index.handler").build()).build());Pattern Construct PropsNameTypeDescriptionexistingLambdaObj?lambda.FunctionExisting instance of Lambda Function object, providing both this andlambdaFunctionPropswill cause an error.lambdaFunctionProps?lambda.FunctionPropsUser provided props to override the default props for the Lambda function.apiGatewayProps?api.LambdaRestApiPropsOptional user-provided props to override the default props for the API.logGroupProps?logs.LogGroupPropsUser provided props to override the default props for for the CloudWatchLogs LogGroup.Pattern PropertiesNameTypeDescriptionlambdaFunctionlambda.FunctionReturns an instance of the Lambda function created by the pattern.apiGatewayapi.LambdaRestApiReturns an instance of the API Gateway REST API created by the pattern.apiGatewayCloudWatchRole?iam.RoleReturns an instance of the iam.Role created by the construct for API Gateway for CloudWatch access.apiGatewayLogGrouplogs.LogGroupReturns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.Default settingsOut of the box implementation of the Construct without any override will set the following defaults:Amazon API GatewayDeploy an edge-optimized API endpointEnable CloudWatch logging for API GatewayConfigure least privilege access IAM role for API GatewaySet the default authorizationType for all API methods to IAMEnable X-Ray TracingAWS Lambda FunctionConfigure limited privilege access IAM role for Lambda functionEnable reusing connections with Keep-Alive for NodeJs Lambda functionEnable X-Ray TracingSet Environment VariablesAWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)Architecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.