cdk-nextjs
Version:
Deploy Next.js apps on AWS with CDK
45 lines (44 loc) • 2.04 kB
TypeScript
import { DockerImageAsset } from "aws-cdk-lib/aws-ecr-assets";
import { Cluster } from "aws-cdk-lib/aws-ecs";
import { ApplicationLoadBalancedFargateService, ApplicationLoadBalancedFargateServiceProps } from "aws-cdk-lib/aws-ecs-patterns";
import { FileSystem } from "aws-cdk-lib/aws-efs";
import { Construct } from "constructs";
import { NextjsComputeBaseProps } from "./nextjs-compute-base-props";
import { NextjsType } from "../constants";
import { OptionalApplicationLoadBalancedTaskImageOptions } from "../generated-structs/OptionalApplicationLoadBalancedTaskImageOptions";
import { OptionalClusterProps } from "../generated-structs/OptionalClusterProps";
export interface NextjsContainersOverrides {
readonly ecsClusterProps?: OptionalClusterProps;
readonly albFargateServiceProps?: ApplicationLoadBalancedFargateServiceProps;
readonly taskImageOptions?: OptionalApplicationLoadBalancedTaskImageOptions;
}
export interface NextjsContainersProps extends NextjsComputeBaseProps {
readonly dockerImageAsset: DockerImageAsset;
readonly fileSystem: FileSystem;
readonly nextjsType: NextjsType;
readonly overrides?: NextjsContainersOverrides;
readonly relativeEntrypointPath: string;
readonly buildId: string;
}
/**
* Next.js load balanced via Application Load Balancer with containers via AWS
* Fargate.
*/
export declare class NextjsContainers extends Construct {
albFargateService: ApplicationLoadBalancedFargateService;
ecsCluster: Cluster;
url: string;
private props;
constructor(scope: Construct, id: string, props: NextjsContainersProps);
private createEcsCluster;
private createAlbFargateSevice;
/**
* Configure health checks for containers at ALB and ECS level. This ensures
* unhealthy containers are removed. Both of these health checks can be
* overwritten by user by accessing `albFargateService` property, so no need
* for `overrides`.
*/
private configureHealthCheck;
private attachFileSystem;
private getUrl;
}