UNPKG

cdk-nextjs

Version:

Deploy Next.js apps on AWS with CDK

89 lines (88 loc) 2.74 kB
import { CustomResource } from "aws-cdk-lib"; import { IVpc } from "aws-cdk-lib/aws-ec2"; import { AccessPoint } from "aws-cdk-lib/aws-efs"; import { DockerImageCode, DockerImageFunction } from "aws-cdk-lib/aws-lambda"; import { Bucket } from "aws-cdk-lib/aws-s3"; import { Construct } from "constructs"; import { NextjsType } from "./constants"; import { OptionalCustomResourceProps } from "./generated-structs/OptionalCustomResourceProps"; import { OptionalDockerImageFunctionProps } from "./generated-structs/OptionalDockerImageFunctionProps"; export interface NextjsAssetDeploymentOverrides { /** * Props that define the custom resource */ readonly customResourceProps?: OptionalCustomResourceProps; readonly dockerImageFunctionProps?: OptionalDockerImageFunctionProps; } export interface NextjsAssetsDeploymentProps { readonly accessPoint: AccessPoint; /** * Prefix to the URI path the app will be served at. * @example "/my-base-path" */ readonly basePath?: string; readonly buildId: string; /** * @see {@link NextjsBuild.buildImageDigest} */ readonly buildImageDigest: string; /** * If true, logs details in custom resource lambda * @default true */ readonly debug?: boolean; readonly dockerImageCode: DockerImageCode; readonly nextjsType: NextjsType; readonly overrides?: NextjsAssetDeploymentOverrides; /** * @see {@link NextjsBaseProps.relativePathToPackage} */ readonly relativePathToPackage?: string; /** * Required for `NextjsType.GlobalFunctions` and `NextjsType.GlobalContainers` */ readonly staticAssetsBucket?: Bucket; readonly vpc: IVpc; } /** * @internal */ export interface FsToS3Action { type: "fs-to-s3"; destinationBucketName: string; destinationKeyPrefix?: string; sourcePath: string; } /** * @internal */ export interface FsToFsAction { type: "fs-to-fs"; sourcePath: string; destinationPath: string; includeExtensions?: string[]; } /** * @internal */ export interface StaticAssetsCustomResourceProperties { actions: (FsToS3Action | FsToFsAction)[]; buildId: string; /** * @see {@link NextjsBuild.buildImageDigest} */ buildImageDigest: string; imageCachePath: string; nextjsType: NextjsType; } /** * Deploys static assets to S3 and cache assets to EFS in Lambda Custom Resource. */ export declare class NextjsAssetsDeployment extends Construct { customResource: CustomResource; dockerImageFunction: DockerImageFunction; private props; constructor(scope: Construct, id: string, props: NextjsAssetsDeploymentProps); private createFunction; private createCustomResource; }