UNPKG

cdk-nextjs-standalone

Version:

Deploy a NextJS app to AWS using CDK and OpenNext.

106 lines (105 loc) 4.68 kB
import type { aws_ec2, aws_iam, aws_kms, aws_lambda, aws_logs, Duration } from 'aws-cdk-lib'; /** * OptionalProviderProps */ export interface OptionalProviderProps { /** * Which subnets from the VPC to place the lambda functions in. * Only used if 'vpc' is supplied. Note: internet access for Lambdas * requires a NAT gateway, so picking Public subnets is not allowed. * @default - the Vpc default strategy if not specified * @stability stable */ readonly vpcSubnets?: aws_ec2.SubnetSelection; /** * The vpc to provision the lambda functions in. * @default - functions are not provisioned inside a vpc. * @stability stable */ readonly vpc?: aws_ec2.IVpc; /** * Total timeout for the entire operation. * The maximum timeout is 1 hour (yes, it can exceed the AWS Lambda 15 minutes) * @default Duration.minutes(30) * @stability stable */ readonly totalTimeout?: Duration; /** * Security groups to attach to the provider functions. * Only used if 'vpc' is supplied * @default - If `vpc` is not supplied, no security groups are attached. Otherwise, a dedicated security group is created for each function. * @stability stable */ readonly securityGroups?: Array<aws_ec2.ISecurityGroup>; /** * AWS Lambda execution role. * The role that will be assumed by the AWS Lambda. * Must be assumable by the 'lambda.amazonaws.com' service principal. * @default - A default role will be created. * @stability stable */ readonly role?: aws_iam.IRole; /** * Time between calls to the `isComplete` handler which determines if the resource has been stabilized. * The first `isComplete` will be called immediately after `handler` and then * every `queryInterval` seconds, and until `timeout` has been reached or until * `isComplete` returns `true`. * @default Duration.seconds(5) * @stability stable */ readonly queryInterval?: Duration; /** * Provider Lambda name. * The provider lambda function name. * @default - CloudFormation default name from unique physical ID * @stability stable */ readonly providerFunctionName?: string; /** * AWS KMS key used to encrypt provider lambda's environment variables. * @default - AWS Lambda creates and uses an AWS managed customer master key (CMK) * @stability stable */ readonly providerFunctionEnvEncryption?: aws_kms.IKey; /** * The number of days framework log events are kept in CloudWatch Logs. * When * updating this property, unsetting it doesn't remove the log retention policy. * To remove the retention policy, set the value to `INFINITE`. * * This is a legacy API and we strongly recommend you migrate to `logGroup` if you can. * `logGroup` allows you to create a fully customizable log group and instruct the Lambda function to send logs to it. * @default logs.RetentionDays.INFINITE * @stability stable */ readonly logRetention?: aws_logs.RetentionDays; /** * The Log Group used for logging of events emitted by the custom resource's lambda function. * Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. * If you are deploying to another type of region, please check regional availability first. * @default - a default log group created by AWS Lambda * @stability stable */ readonly logGroup?: aws_logs.ILogGroup; /** * The AWS Lambda function to invoke in order to determine if the operation is complete. * This function will be called immediately after `onEvent` and then * periodically based on the configured query interval as long as it returns * `false`. If the function still returns `false` and the alloted timeout has * passed, the operation will fail. * @default - provider is synchronous. This means that the `onEvent` handler is expected to finish all lifecycle operations within the initial invocation. * @stability stable */ readonly isCompleteHandler?: aws_lambda.IFunction; /** * The AWS Lambda function to invoke for all resource lifecycle operations (CREATE/UPDATE/DELETE). * This function is responsible to begin the requested resource operation * (CREATE/UPDATE/DELETE) and return any additional properties to add to the * event, which will later be passed to `isComplete`. The `PhysicalResourceId` * property must be included in the response. * @stability stable */ readonly onEventHandler?: aws_lambda.IFunction; }