cdk-construct-cdk2
TypeScript icon, indicating that this package has built-in type declarations

3.2.0-v2 • Public • Published

@sls-next/cdk-construct

This is fork of @sls-next/cdk-construct package with CDK v2 being used instead of v1 (way simpler setup)

How to deploy Next.js to AWS via CDK v2 (currently in RC state):

stack.ts file:

import { Stack, StackProps } from "aws-cdk-lib";
import { Construct } from 'constructs';
import { NextJSLambdaEdge } from "@sls-next/cdk-construct";

export class MyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps) {
    super(scope, id, props);
    new NextJSLambdaEdge(this, "NextJsApp", {
      serverlessBuildOutDir: "./build"
    });
  }
}

bin.ts file:

import { App } from "aws-cdk-lib";
import { Builder } from "@sls-next/lambda-at-edge";
import { MyStack } from "./stack";

// Run the serverless builder for Next.js app, this could be done elsewhere in your workflow
const builder = new Builder(".", "./build", { args: ["build"] });

builder
  .build()
  .then(() => {
    const app = new App();
    new MyStack(app, `MyStack`);
  })
  .catch((e) => {
    console.log(e);
    process.exit(1);
  });

Readme

Keywords

Package Sidebar

Install

npm i cdk-construct-cdk2

Weekly Downloads

0

Version

3.2.0-v2

License

MIT

Unpacked Size

47.8 kB

Total Files

23

Last publish

Collaborators

  • ozonep