cdk-nextjs-standalone
Version:
Deploy a NextJS app to AWS using CDK and OpenNext.
148 lines (147 loc) • 6.63 kB
TypeScript
import type { aws_ec2, aws_iam, aws_lambda, aws_logs, custom_resources, Duration, interfaces } from 'aws-cdk-lib';
/**
* OptionalProviderProps
*/
export interface OptionalProviderProps {
/**
* Defines what execution history events of the waiter state machine are logged and where they are logged.
* @default - A default log group will be created if logging for the waiter state machine is enabled.
* @stability stable
*/
readonly waiterStateMachineLogOptions?: custom_resources.LogOptions;
/**
* 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 is shared by provider framework's onEvent, isComplete lambda, and onTimeout Lambda functions.
* This role will be assumed by the AWS Lambda, so it must be assumable by the 'lambda.amazonaws.com'
* service principal.
* @default - A default role will be created.
* @deprecated - Use frameworkOnEventRole, frameworkCompleteAndTimeoutRole
* @stability deprecated
*/
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?: interfaces.aws_kms.IKeyRef;
/**
* 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;
/**
* Lambda execution role for provider framework's onEvent Lambda function.
* Note that this role must be assumed
* by the 'lambda.amazonaws.com' service principal.
*
* This property cannot be used with 'role' property
* @default - A default role will be created.
* @stability stable
*/
readonly frameworkOnEventRole?: aws_iam.IRole;
/**
* Log level of the provider framework lambda.
* @default true - Logging is disabled by default
* @stability stable
*/
readonly frameworkLambdaLoggingLevel?: aws_lambda.ApplicationLogLevel;
/**
* Lambda execution role for provider framework's isComplete/onTimeout Lambda function.
* Note that this role
* must be assumed by the 'lambda.amazonaws.com' service principal. To prevent circular dependency problem
* in the provider framework, please ensure you specify a different IAM Role for 'frameworkCompleteAndTimeoutRole'
* from 'frameworkOnEventRole'.
*
* This property cannot be used with 'role' property
* @default - A default role will be created.
* @stability stable
*/
readonly frameworkCompleteAndTimeoutRole?: aws_iam.IRole;
/**
* Whether logging for the waiter state machine is disabled.
* @default - true
* @stability stable
*/
readonly disableWaiterStateMachineLogging?: boolean;
/**
* 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;
}