import { DockerImageAsset } from "aws-cdk-lib/aws-ecr-assets"; import { ICluster } from "aws-cdk-lib/aws-ecs"; import { ApplicationLoadBalancedFargateService, ApplicationLoadBalancedFargateServiceProps } from "aws-cdk-lib/aws-ecs-patterns"; import { IApplicationLoadBalancer } from "aws-cdk-lib/aws-elasticloadbalancingv2"; import { Construct } from "constructs"; import { NextjsComputeBaseProps } from "./nextjs-compute-base-props"; import { OptionalApplicationLoadBalancedTaskImageOptions } from "../generated-structs/OptionalApplicationLoadBalancedTaskImageOptions"; import { OptionalClusterProps } from "../generated-structs/OptionalClusterProps"; import { OptionalDockerImageAssetProps } from "../generated-structs/OptionalDockerImageAssetProps"; export interface NextjsContainersOverrides { readonly ecsClusterProps?: OptionalClusterProps; readonly albFargateServiceProps?: ApplicationLoadBalancedFargateServiceProps; readonly taskImageOptions?: OptionalApplicationLoadBalancedTaskImageOptions; readonly dockerImageAssetProps?: OptionalDockerImageAssetProps; } export interface NextjsContainersProps extends NextjsComputeBaseProps { /** * Bring your own Application Load Balancer. When provided, it is passed * directly to `ApplicationLoadBalancedFargateService`. If the ALB already * has a listener on port 80, call `removeAutoCreatedListener()` after * construction to avoid deployment failures. */ readonly alb?: IApplicationLoadBalancer; /** * Bring your own ECS cluster. When provided, cdk-nextjs will skip creating * a new cluster and VPC gateway endpoints. The cluster is passed directly * to `ApplicationLoadBalancedFargateService`. */ readonly ecsCluster?: ICluster; readonly overrides?: NextjsContainersOverrides; readonly relativeEntrypointPath: string; } /** * Next.js load balanced via Application Load Balancer with containers via AWS * Fargate. */ export declare class NextjsContainers extends Construct { albFargateService: ApplicationLoadBalancedFargateService; ecsCluster: ICluster; url: string; dockerImageAsset: DockerImageAsset; private props; constructor(scope: Construct, id: string, props: NextjsContainersProps); private createEcsCluster; /** * Add Gateway VPC endpoints for S3 and DynamoDB if user didn't provide a VPC. * Gateway endpoints are free and improve performance by keeping traffic within AWS network. */ private addVpcGatewayEndpoints; private createDockerImageAsset; private getDockerfileName; private copyDockerfileToContext; 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 getUrl; /** * Remove the HTTP listener that `ApplicationLoadBalancedFargateService` * always creates. Call this when you bring your own ALB that already has a * listener on the same port (typically port 80) to avoid a * "listener already exists on this port" deployment failure. * * This method: * 1. Removes the L1 `CfnListener` resource (keeps the L2 node so the * target group child is preserved). * 2. Removes the associated security-group ingress rule for port 80. * 3. Rebuilds the ECS service `DependsOn` without the deleted listener. * 4. Removes `CfnOutput` resources auto-created by the ecs-patterns construct. */ removeAutoCreatedListener(): void; }