A CDK construct that creates an API Gateway and Lambda function that can be used to expose a Micro API project for RenovoLive.
import { MicroApi } from '@renovosolutions/cdk-library-renovo-microapi'
new MicroApi(scope: Construct, id: string, props: MicroApiProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
MicroApiProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: MicroApiProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
public toString(): string
Returns a string representation of this construct.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { MicroApi } from '@renovosolutions/cdk-library-renovo-microapi'
MicroApi.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
import { MicroApiProps } from '@renovosolutions/cdk-library-renovo-microapi'
const microApiProps: MicroApiProps = { ... }
Name | Type | Description |
---|---|---|
allowedOrigins |
string[] |
The allowed origins for CORS policy on the API Gateway. |
apiName |
string |
The name of the project this Micro API is for. |
code |
aws-cdk-lib.aws_lambda.Code |
The lambda code to use for this Micro API. |
handler |
string |
The name of the method within your code that Lambda calls to execute your function. |
vpc |
aws-cdk-lib.aws_ec2.IVpc |
The vpc where the Lambda function will run. |
vpcEndpoint |
aws-cdk-lib.aws_ec2.IInterfaceVpcEndpoint |
The vpc endpoint to associate the API with. |
authorizationType |
aws-cdk-lib.aws_apigateway.AuthorizationType |
The type of authorization to use for the API. |
environment |
{[ key: string ]: string} |
The environment variables the Lambda function will use. |
ephemeralStorageSize |
aws-cdk-lib.Size |
The size of the functions /tmp directory in MB. |
memorySize |
number |
The amount of memory, in MB, that is allocated to your Lambda function. |
runtime |
aws-cdk-lib.aws_lambda.Runtime |
The runtime to use for this Micro API. |
stageName |
string |
The stage name to use for the deployment. |
timeout |
aws-cdk-lib.Duration |
The lambda function timeout. |
public readonly allowedOrigins: string[];
- Type: string[]
The allowed origins for CORS policy on the API Gateway.
public readonly apiName: string;
- Type: string
The name of the project this Micro API is for.
public readonly code: Code;
- Type: aws-cdk-lib.aws_lambda.Code
The lambda code to use for this Micro API.
public readonly handler: string;
- Type: string
The name of the method within your code that Lambda calls to execute your function.
The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information:
Use Handler.FROM_IMAGE
when defining a function from a Docker image.
NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-features.html#gettingstarted-features-programmingmodel
Use Handler.FROM_IMAGE
when defining a function from a Docker image.
NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.)
public readonly vpc: IVpc;
- Type: aws-cdk-lib.aws_ec2.IVpc
The vpc where the Lambda function will run.
public readonly vpcEndpoint: IInterfaceVpcEndpoint;
- Type: aws-cdk-lib.aws_ec2.IInterfaceVpcEndpoint
The vpc endpoint to associate the API with.
public readonly authorizationType: AuthorizationType;
- Type: aws-cdk-lib.aws_apigateway.AuthorizationType
- Default: apigateway.AuthorizationType.IAM
The type of authorization to use for the API.
public readonly environment: {[ key: string ]: string};
- Type: {[ key: string ]: string}
The environment variables the Lambda function will use.
public readonly ephemeralStorageSize: Size;
- Type: aws-cdk-lib.Size
- Default: Size.mebibytes(512)
The size of the functions /tmp
directory in MB.
public readonly memorySize: number;
- Type: number
- Default: 128
The amount of memory, in MB, that is allocated to your Lambda function.
Lambda uses this value to proportionally allocate the amount of CPU power.
public readonly runtime: Runtime;
- Type: aws-cdk-lib.aws_lambda.Runtime
- Default: lambda.Runtime.DOTNET_6
The runtime to use for this Micro API.
public readonly stageName: string;
- Type: string
- Default: 'dev'
The stage name to use for the deployment.
public readonly timeout: Duration;
- Type: aws-cdk-lib.Duration
- Default: Duration.seconds(30)
The lambda function timeout.