UNPKG

cdk-nextjs

Version:

Deploy Next.js apps on AWS with CDK

43 lines (42 loc) 1.75 kB
import { Connections, IVpc } from "aws-cdk-lib/aws-ec2"; import { AccessPoint, AccessPointProps, FileSystem, FileSystemProps } from "aws-cdk-lib/aws-efs"; import { IRole } from "aws-cdk-lib/aws-iam"; import { Construct } from "constructs"; export interface NextjsFileSystemOverrides { readonly fileSystemProps?: FileSystemProps; readonly accessPointProps?: AccessPointProps; } export interface NextjsFileSystemProps { readonly overrides?: NextjsFileSystemOverrides; readonly vpc: IVpc; } export interface AllowComputeProps { readonly connections: Connections; readonly role: IRole; } /** * Next.js Network File System enabling sharing of image optimization cache, * data cach, and pages cache. */ export declare class NextjsFileSystem extends Construct { fileSystem: FileSystem; accessPoint: AccessPoint; private props; constructor(scope: Construct, id: string, props: NextjsFileSystemProps); /** * Creates EFS File System * * Note, the resource policy for the File System will include the boolean * condition, `"elasticfilesystem:AccessedViaMountTarget": "true"` which from * CDK [docs](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs-readme.html#permissions) * says, "only allow access to clients using IAM authentication and deny access * to anonymous clients". * @see https://docs.aws.amazon.com/efs/latest/ug/access-control-block-public-access.html * * Ideally we could add IAM string condition `elasticfilesystem:AccessPointArn` * to the resource policy but this causes circular dependency. */ private createFileSystem; private createAccessPoint; allowCompute({ connections, role }: AllowComputeProps): void; }