cdk-nextjs-standalone
Version:
Deploy a NextJS app to AWS using CDK and OpenNext.
1,413 lines (850 loc) • 354 kB
Markdown
# API Reference <a name="API Reference" id="api-reference"></a>
## Constructs <a name="Constructs" id="Constructs"></a>
### Nextjs <a name="Nextjs" id="cdk-nextjs-standalone.Nextjs"></a>
The `Nextjs` construct is a higher level construct that makes it easy to create a NextJS app.
Your standalone server application will be bundled using o(utput tracing and will be deployed to a Lambda function.
Static assets will be deployed to an S3 bucket and served via CloudFront.
You must use Next.js 10.3.0 or newer.
Please provide a `nextjsPath` to the Next.js app inside your project.
*Example*
```typescript
new Nextjs(this, "Web", {
nextjsPath: path.resolve("packages/web"),
})
```
#### Initializers <a name="Initializers" id="cdk-nextjs-standalone.Nextjs.Initializer"></a>
```typescript
import { Nextjs } from 'cdk-nextjs-standalone'
new Nextjs(scope: Construct, id: string, props: NextjsProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.Nextjs.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.Nextjs.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.Nextjs.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsProps">NextjsProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.Nextjs.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.Nextjs.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.Nextjs.Initializer.parameter.props"></a>
- *Type:* <a href="#cdk-nextjs-standalone.NextjsProps">NextjsProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.Nextjs.toString">toString</a></code> | Returns a string representation of this construct. |
---
##### `toString` <a name="toString" id="cdk-nextjs-standalone.Nextjs.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.Nextjs.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
---
##### ~~`isConstruct`~~ <a name="isConstruct" id="cdk-nextjs-standalone.Nextjs.isConstruct"></a>
```typescript
import { Nextjs } from 'cdk-nextjs-standalone'
Nextjs.isConstruct(x: any)
```
Checks if `x` is a construct.
###### `x`<sup>Required</sup> <a name="x" id="cdk-nextjs-standalone.Nextjs.isConstruct.parameter.x"></a>
- *Type:* any
Any object.
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.bucket">bucket</a></code> | <code>aws-cdk-lib.aws_s3.IBucket</code> | Convenience method to access `Nextjs.staticAssets.bucket`. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.url">url</a></code> | <code>string</code> | URL of Next.js App. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.distribution">distribution</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsDistribution">NextjsDistribution</a></code> | CloudFront distribution. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.imageOptimizationFunction">imageOptimizationFunction</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsImage">NextjsImage</a></code> | The image optimization handler lambda function. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.imageOptimizationLambdaFunctionUrl">imageOptimizationLambdaFunctionUrl</a></code> | <code>aws-cdk-lib.aws_lambda.FunctionUrl</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.lambdaFunctionUrl">lambdaFunctionUrl</a></code> | <code>aws-cdk-lib.aws_lambda.FunctionUrl</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.nextBuild">nextBuild</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsBuild">NextjsBuild</a></code> | Built NextJS project output. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.revalidation">revalidation</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsRevalidation">NextjsRevalidation</a></code> | Revalidation handler and queue. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.serverFunction">serverFunction</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsServer">NextjsServer</a></code> | The main NextJS server handler lambda function. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.staticAssets">staticAssets</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsStaticAssets">NextjsStaticAssets</a></code> | Asset deployment to S3. |
| <code><a href="#cdk-nextjs-standalone.Nextjs.property.domain">domain</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsDomain">NextjsDomain</a></code> | Optional Route53 Hosted Zone, ACM Certificate, and Route53 DNS Records. |
---
##### `node`<sup>Required</sup> <a name="node" id="cdk-nextjs-standalone.Nextjs.property.node"></a>
```typescript
public readonly node: Node;
```
- *Type:* constructs.Node
The tree node.
---
##### `bucket`<sup>Required</sup> <a name="bucket" id="cdk-nextjs-standalone.Nextjs.property.bucket"></a>
```typescript
public readonly bucket: IBucket;
```
- *Type:* aws-cdk-lib.aws_s3.IBucket
Convenience method to access `Nextjs.staticAssets.bucket`.
---
##### `url`<sup>Required</sup> <a name="url" id="cdk-nextjs-standalone.Nextjs.property.url"></a>
```typescript
public readonly url: string;
```
- *Type:* string
URL of Next.js App.
---
##### `distribution`<sup>Required</sup> <a name="distribution" id="cdk-nextjs-standalone.Nextjs.property.distribution"></a>
```typescript
public readonly distribution: NextjsDistribution;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsDistribution">NextjsDistribution</a>
CloudFront distribution.
---
##### `imageOptimizationFunction`<sup>Required</sup> <a name="imageOptimizationFunction" id="cdk-nextjs-standalone.Nextjs.property.imageOptimizationFunction"></a>
```typescript
public readonly imageOptimizationFunction: NextjsImage;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsImage">NextjsImage</a>
The image optimization handler lambda function.
---
##### `imageOptimizationLambdaFunctionUrl`<sup>Required</sup> <a name="imageOptimizationLambdaFunctionUrl" id="cdk-nextjs-standalone.Nextjs.property.imageOptimizationLambdaFunctionUrl"></a>
```typescript
public readonly imageOptimizationLambdaFunctionUrl: FunctionUrl;
```
- *Type:* aws-cdk-lib.aws_lambda.FunctionUrl
---
##### `lambdaFunctionUrl`<sup>Required</sup> <a name="lambdaFunctionUrl" id="cdk-nextjs-standalone.Nextjs.property.lambdaFunctionUrl"></a>
```typescript
public readonly lambdaFunctionUrl: FunctionUrl;
```
- *Type:* aws-cdk-lib.aws_lambda.FunctionUrl
---
##### `nextBuild`<sup>Required</sup> <a name="nextBuild" id="cdk-nextjs-standalone.Nextjs.property.nextBuild"></a>
```typescript
public readonly nextBuild: NextjsBuild;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsBuild">NextjsBuild</a>
Built NextJS project output.
---
##### `revalidation`<sup>Required</sup> <a name="revalidation" id="cdk-nextjs-standalone.Nextjs.property.revalidation"></a>
```typescript
public readonly revalidation: NextjsRevalidation;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsRevalidation">NextjsRevalidation</a>
Revalidation handler and queue.
---
##### `serverFunction`<sup>Required</sup> <a name="serverFunction" id="cdk-nextjs-standalone.Nextjs.property.serverFunction"></a>
```typescript
public readonly serverFunction: NextjsServer;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsServer">NextjsServer</a>
The main NextJS server handler lambda function.
---
##### `staticAssets`<sup>Required</sup> <a name="staticAssets" id="cdk-nextjs-standalone.Nextjs.property.staticAssets"></a>
```typescript
public readonly staticAssets: NextjsStaticAssets;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsStaticAssets">NextjsStaticAssets</a>
Asset deployment to S3.
---
##### `domain`<sup>Optional</sup> <a name="domain" id="cdk-nextjs-standalone.Nextjs.property.domain"></a>
```typescript
public readonly domain: NextjsDomain;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsDomain">NextjsDomain</a>
Optional Route53 Hosted Zone, ACM Certificate, and Route53 DNS Records.
---
### NextjsBucketDeployment <a name="NextjsBucketDeployment" id="cdk-nextjs-standalone.NextjsBucketDeployment"></a>
Similar to CDK's `BucketDeployment` construct, but with a focus on replacing template placeholders (i.e. environment variables) and configuring PUT options like cache control.
#### Initializers <a name="Initializers" id="cdk-nextjs-standalone.NextjsBucketDeployment.Initializer"></a>
```typescript
import { NextjsBucketDeployment } from 'cdk-nextjs-standalone'
new NextjsBucketDeployment(scope: Construct, id: string, props: NextjsBucketDeploymentProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsBucketDeploymentProps">NextjsBucketDeploymentProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.NextjsBucketDeployment.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsBucketDeployment.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.NextjsBucketDeployment.Initializer.parameter.props"></a>
- *Type:* <a href="#cdk-nextjs-standalone.NextjsBucketDeploymentProps">NextjsBucketDeploymentProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.toString">toString</a></code> | Returns a string representation of this construct. |
---
##### `toString` <a name="toString" id="cdk-nextjs-standalone.NextjsBucketDeployment.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.getSubstitutionConfig">getSubstitutionConfig</a></code> | Creates `substitutionConfig` an object by extracting unresolved tokens. |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.getSubstitutionValue">getSubstitutionValue</a></code> | Formats a string as a template value so custom resource knows to replace. |
---
##### ~~`isConstruct`~~ <a name="isConstruct" id="cdk-nextjs-standalone.NextjsBucketDeployment.isConstruct"></a>
```typescript
import { NextjsBucketDeployment } from 'cdk-nextjs-standalone'
NextjsBucketDeployment.isConstruct(x: any)
```
Checks if `x` is a construct.
###### `x`<sup>Required</sup> <a name="x" id="cdk-nextjs-standalone.NextjsBucketDeployment.isConstruct.parameter.x"></a>
- *Type:* any
Any object.
---
##### `getSubstitutionConfig` <a name="getSubstitutionConfig" id="cdk-nextjs-standalone.NextjsBucketDeployment.getSubstitutionConfig"></a>
```typescript
import { NextjsBucketDeployment } from 'cdk-nextjs-standalone'
NextjsBucketDeployment.getSubstitutionConfig(env: {[ key: string ]: string})
```
Creates `substitutionConfig` an object by extracting unresolved tokens.
###### `env`<sup>Required</sup> <a name="env" id="cdk-nextjs-standalone.NextjsBucketDeployment.getSubstitutionConfig.parameter.env"></a>
- *Type:* {[ key: string ]: string}
---
##### `getSubstitutionValue` <a name="getSubstitutionValue" id="cdk-nextjs-standalone.NextjsBucketDeployment.getSubstitutionValue"></a>
```typescript
import { NextjsBucketDeployment } from 'cdk-nextjs-standalone'
NextjsBucketDeployment.getSubstitutionValue(v: string)
```
Formats a string as a template value so custom resource knows to replace.
###### `v`<sup>Required</sup> <a name="v" id="cdk-nextjs-standalone.NextjsBucketDeployment.getSubstitutionValue.parameter.v"></a>
- *Type:* string
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
| <code><a href="#cdk-nextjs-standalone.NextjsBucketDeployment.property.function">function</a></code> | <code>aws-cdk-lib.aws_lambda.Function</code> | Lambda Function Provider for Custom Resource. |
---
##### `node`<sup>Required</sup> <a name="node" id="cdk-nextjs-standalone.NextjsBucketDeployment.property.node"></a>
```typescript
public readonly node: Node;
```
- *Type:* constructs.Node
The tree node.
---
##### `function`<sup>Required</sup> <a name="function" id="cdk-nextjs-standalone.NextjsBucketDeployment.property.function"></a>
```typescript
public readonly function: Function;
```
- *Type:* aws-cdk-lib.aws_lambda.Function
Lambda Function Provider for Custom Resource.
---
### NextjsBuild <a name="NextjsBuild" id="cdk-nextjs-standalone.NextjsBuild"></a>
Build Next.js app.
#### Initializers <a name="Initializers" id="cdk-nextjs-standalone.NextjsBuild.Initializer"></a>
```typescript
import { NextjsBuild } from 'cdk-nextjs-standalone'
new NextjsBuild(scope: Construct, id: string, props: NextjsBuildProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsBuildProps">NextjsBuildProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.NextjsBuild.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsBuild.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.NextjsBuild.Initializer.parameter.props"></a>
- *Type:* <a href="#cdk-nextjs-standalone.NextjsBuildProps">NextjsBuildProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.readPublicFileList">readPublicFileList</a></code> | *No description.* |
---
##### `toString` <a name="toString" id="cdk-nextjs-standalone.NextjsBuild.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
##### `readPublicFileList` <a name="readPublicFileList" id="cdk-nextjs-standalone.NextjsBuild.readPublicFileList"></a>
```typescript
public readPublicFileList(): string[]
```
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
---
##### ~~`isConstruct`~~ <a name="isConstruct" id="cdk-nextjs-standalone.NextjsBuild.isConstruct"></a>
```typescript
import { NextjsBuild } from 'cdk-nextjs-standalone'
NextjsBuild.isConstruct(x: any)
```
Checks if `x` is a construct.
###### `x`<sup>Required</sup> <a name="x" id="cdk-nextjs-standalone.NextjsBuild.isConstruct.parameter.x"></a>
- *Type:* any
Any object.
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.nextCacheDir">nextCacheDir</a></code> | <code>string</code> | Cache directory for generated data. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.nextImageFnDir">nextImageFnDir</a></code> | <code>string</code> | Contains function for processessing image requests. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.nextRevalidateDynamoDBProviderFnDir">nextRevalidateDynamoDBProviderFnDir</a></code> | <code>string</code> | Contains function for inserting revalidation items into the table. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.nextRevalidateFnDir">nextRevalidateFnDir</a></code> | <code>string</code> | Contains function for processing items from revalidation queue. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.nextServerFnDir">nextServerFnDir</a></code> | <code>string</code> | Contains server code and dependencies. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.nextStaticDir">nextStaticDir</a></code> | <code>string</code> | Static files containing client-side code. |
| <code><a href="#cdk-nextjs-standalone.NextjsBuild.property.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsBuildProps">NextjsBuildProps</a></code> | *No description.* |
---
##### `node`<sup>Required</sup> <a name="node" id="cdk-nextjs-standalone.NextjsBuild.property.node"></a>
```typescript
public readonly node: Node;
```
- *Type:* constructs.Node
The tree node.
---
##### `nextCacheDir`<sup>Required</sup> <a name="nextCacheDir" id="cdk-nextjs-standalone.NextjsBuild.property.nextCacheDir"></a>
```typescript
public readonly nextCacheDir: string;
```
- *Type:* string
Cache directory for generated data.
---
##### `nextImageFnDir`<sup>Required</sup> <a name="nextImageFnDir" id="cdk-nextjs-standalone.NextjsBuild.property.nextImageFnDir"></a>
```typescript
public readonly nextImageFnDir: string;
```
- *Type:* string
Contains function for processessing image requests.
Should be arm64.
---
##### `nextRevalidateDynamoDBProviderFnDir`<sup>Required</sup> <a name="nextRevalidateDynamoDBProviderFnDir" id="cdk-nextjs-standalone.NextjsBuild.property.nextRevalidateDynamoDBProviderFnDir"></a>
```typescript
public readonly nextRevalidateDynamoDBProviderFnDir: string;
```
- *Type:* string
Contains function for inserting revalidation items into the table.
---
##### `nextRevalidateFnDir`<sup>Required</sup> <a name="nextRevalidateFnDir" id="cdk-nextjs-standalone.NextjsBuild.property.nextRevalidateFnDir"></a>
```typescript
public readonly nextRevalidateFnDir: string;
```
- *Type:* string
Contains function for processing items from revalidation queue.
---
##### `nextServerFnDir`<sup>Required</sup> <a name="nextServerFnDir" id="cdk-nextjs-standalone.NextjsBuild.property.nextServerFnDir"></a>
```typescript
public readonly nextServerFnDir: string;
```
- *Type:* string
Contains server code and dependencies.
---
##### `nextStaticDir`<sup>Required</sup> <a name="nextStaticDir" id="cdk-nextjs-standalone.NextjsBuild.property.nextStaticDir"></a>
```typescript
public readonly nextStaticDir: string;
```
- *Type:* string
Static files containing client-side code.
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.NextjsBuild.property.props"></a>
```typescript
public readonly props: NextjsBuildProps;
```
- *Type:* <a href="#cdk-nextjs-standalone.NextjsBuildProps">NextjsBuildProps</a>
---
### NextjsDistribution <a name="NextjsDistribution" id="cdk-nextjs-standalone.NextjsDistribution"></a>
Create a CloudFront distribution to serve a Next.js application.
#### Initializers <a name="Initializers" id="cdk-nextjs-standalone.NextjsDistribution.Initializer"></a>
```typescript
import { NextjsDistribution } from 'cdk-nextjs-standalone'
new NextjsDistribution(scope: Construct, id: string, props: NextjsDistributionProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsDistributionProps">NextjsDistributionProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.NextjsDistribution.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsDistribution.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.NextjsDistribution.Initializer.parameter.props"></a>
- *Type:* <a href="#cdk-nextjs-standalone.NextjsDistributionProps">NextjsDistributionProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.toString">toString</a></code> | Returns a string representation of this construct. |
---
##### `toString` <a name="toString" id="cdk-nextjs-standalone.NextjsDistribution.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
---
##### ~~`isConstruct`~~ <a name="isConstruct" id="cdk-nextjs-standalone.NextjsDistribution.isConstruct"></a>
```typescript
import { NextjsDistribution } from 'cdk-nextjs-standalone'
NextjsDistribution.isConstruct(x: any)
```
Checks if `x` is a construct.
###### `x`<sup>Required</sup> <a name="x" id="cdk-nextjs-standalone.NextjsDistribution.isConstruct.parameter.x"></a>
- *Type:* any
Any object.
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.property.distributionDomain">distributionDomain</a></code> | <code>string</code> | The domain name of the internally created CloudFront Distribution. |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.property.distributionId">distributionId</a></code> | <code>string</code> | The ID of the internally created CloudFront Distribution. |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.property.url">url</a></code> | <code>string</code> | The CloudFront URL of the website. |
| <code><a href="#cdk-nextjs-standalone.NextjsDistribution.property.distribution">distribution</a></code> | <code>aws-cdk-lib.aws_cloudfront.Distribution</code> | The internally created CloudFront `Distribution` instance. |
---
##### `node`<sup>Required</sup> <a name="node" id="cdk-nextjs-standalone.NextjsDistribution.property.node"></a>
```typescript
public readonly node: Node;
```
- *Type:* constructs.Node
The tree node.
---
##### `distributionDomain`<sup>Required</sup> <a name="distributionDomain" id="cdk-nextjs-standalone.NextjsDistribution.property.distributionDomain"></a>
```typescript
public readonly distributionDomain: string;
```
- *Type:* string
The domain name of the internally created CloudFront Distribution.
---
##### `distributionId`<sup>Required</sup> <a name="distributionId" id="cdk-nextjs-standalone.NextjsDistribution.property.distributionId"></a>
```typescript
public readonly distributionId: string;
```
- *Type:* string
The ID of the internally created CloudFront Distribution.
---
##### `url`<sup>Required</sup> <a name="url" id="cdk-nextjs-standalone.NextjsDistribution.property.url"></a>
```typescript
public readonly url: string;
```
- *Type:* string
The CloudFront URL of the website.
---
##### `distribution`<sup>Required</sup> <a name="distribution" id="cdk-nextjs-standalone.NextjsDistribution.property.distribution"></a>
```typescript
public readonly distribution: Distribution;
```
- *Type:* aws-cdk-lib.aws_cloudfront.Distribution
The internally created CloudFront `Distribution` instance.
---
### NextjsDomain <a name="NextjsDomain" id="cdk-nextjs-standalone.NextjsDomain"></a>
Use a custom domain with `Nextjs`.
Requires a Route53 hosted zone to have been
created within the same AWS account. For DNS setups where you cannot use a
Route53 hosted zone in the same AWS account, use the `overrides.nextjsDistribution.distributionProps`
prop of {@link NextjsProps}.
See {@link NextjsDomainProps} TS Doc comments for detailed docs on how to customize.
This construct is helpful to user to not have to worry about interdependencies
between Route53 Hosted Zone, CloudFront Distribution, and Route53 Hosted Zone Records.
Note, if you're using another service for domain name registration, you can
still create a Route53 hosted zone. Please see [Configuring DNS Delegation from
CloudFlare to AWS Route53](https://veducate.co.uk/dns-delegation-route53/)
as an example.
#### Initializers <a name="Initializers" id="cdk-nextjs-standalone.NextjsDomain.Initializer"></a>
```typescript
import { NextjsDomain } from 'cdk-nextjs-standalone'
new NextjsDomain(scope: Construct, id: string, props: NextjsDomainProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsDomainProps">NextjsDomainProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.NextjsDomain.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsDomain.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.NextjsDomain.Initializer.parameter.props"></a>
- *Type:* <a href="#cdk-nextjs-standalone.NextjsDomainProps">NextjsDomainProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.createDnsRecords">createDnsRecords</a></code> | Creates DNS records (A and AAAA) records for {@link NextjsDomainProps.domainName} and {@link NextjsDomainProps.alternateNames} if defined. |
---
##### `toString` <a name="toString" id="cdk-nextjs-standalone.NextjsDomain.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
##### `createDnsRecords` <a name="createDnsRecords" id="cdk-nextjs-standalone.NextjsDomain.createDnsRecords"></a>
```typescript
public createDnsRecords(distribution: Distribution): void
```
Creates DNS records (A and AAAA) records for {@link NextjsDomainProps.domainName} and {@link NextjsDomainProps.alternateNames} if defined.
###### `distribution`<sup>Required</sup> <a name="distribution" id="cdk-nextjs-standalone.NextjsDomain.createDnsRecords.parameter.distribution"></a>
- *Type:* aws-cdk-lib.aws_cloudfront.Distribution
---
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
---
##### ~~`isConstruct`~~ <a name="isConstruct" id="cdk-nextjs-standalone.NextjsDomain.isConstruct"></a>
```typescript
import { NextjsDomain } from 'cdk-nextjs-standalone'
NextjsDomain.isConstruct(x: any)
```
Checks if `x` is a construct.
###### `x`<sup>Required</sup> <a name="x" id="cdk-nextjs-standalone.NextjsDomain.isConstruct.parameter.x"></a>
- *Type:* any
Any object.
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.property.domainNames">domainNames</a></code> | <code>string[]</code> | Concatentation of {@link NextjsDomainProps.domainName} and {@link NextjsDomainProps.alternateNames}. Used in instantiation of CloudFront Distribution in NextjsDistribution. |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.property.certificate">certificate</a></code> | <code>aws-cdk-lib.aws_certificatemanager.ICertificate</code> | ACM Certificate. |
| <code><a href="#cdk-nextjs-standalone.NextjsDomain.property.hostedZone">hostedZone</a></code> | <code>aws-cdk-lib.aws_route53.IHostedZone</code> | Route53 Hosted Zone. |
---
##### `node`<sup>Required</sup> <a name="node" id="cdk-nextjs-standalone.NextjsDomain.property.node"></a>
```typescript
public readonly node: Node;
```
- *Type:* constructs.Node
The tree node.
---
##### `domainNames`<sup>Required</sup> <a name="domainNames" id="cdk-nextjs-standalone.NextjsDomain.property.domainNames"></a>
```typescript
public readonly domainNames: string[];
```
- *Type:* string[]
Concatentation of {@link NextjsDomainProps.domainName} and {@link NextjsDomainProps.alternateNames}. Used in instantiation of CloudFront Distribution in NextjsDistribution.
---
##### `certificate`<sup>Required</sup> <a name="certificate" id="cdk-nextjs-standalone.NextjsDomain.property.certificate"></a>
```typescript
public readonly certificate: ICertificate;
```
- *Type:* aws-cdk-lib.aws_certificatemanager.ICertificate
ACM Certificate.
---
##### `hostedZone`<sup>Required</sup> <a name="hostedZone" id="cdk-nextjs-standalone.NextjsDomain.property.hostedZone"></a>
```typescript
public readonly hostedZone: IHostedZone;
```
- *Type:* aws-cdk-lib.aws_route53.IHostedZone
Route53 Hosted Zone.
---
### NextjsImage <a name="NextjsImage" id="cdk-nextjs-standalone.NextjsImage"></a>
This lambda handles image optimization.
#### Initializers <a name="Initializers" id="cdk-nextjs-standalone.NextjsImage.Initializer"></a>
```typescript
import { NextjsImage } from 'cdk-nextjs-standalone'
new NextjsImage(scope: Construct, id: string, props: NextjsImageProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.Initializer.parameter.props">props</a></code> | <code><a href="#cdk-nextjs-standalone.NextjsImageProps">NextjsImageProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.NextjsImage.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsImage.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="cdk-nextjs-standalone.NextjsImage.Initializer.parameter.props"></a>
- *Type:* <a href="#cdk-nextjs-standalone.NextjsImageProps">NextjsImageProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addEventSource">addEventSource</a></code> | Adds an event source to this function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addEventSourceMapping">addEventSourceMapping</a></code> | Adds an event source that maps to this AWS Lambda function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addFunctionUrl">addFunctionUrl</a></code> | Adds a url to this lambda function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addPermission">addPermission</a></code> | Adds a permission to the Lambda resource policy. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the IAM role assumed by the instance. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.configureAsyncInvoke">configureAsyncInvoke</a></code> | Configures options for asynchronous invocation. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.considerWarningOnInvokeFunctionPermissions">considerWarningOnInvokeFunctionPermissions</a></code> | A warning will be added to functions under the following conditions: - permissions that include `lambda:InvokeFunction` are added to the unqualified function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.grantInvoke">grantInvoke</a></code> | Grant the given identity permissions to invoke this Lambda. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.grantInvokeCompositePrincipal">grantInvokeCompositePrincipal</a></code> | Grant multiple principals the ability to invoke this Lambda via CompositePrincipal. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.grantInvokeUrl">grantInvokeUrl</a></code> | Grant the given identity permissions to invoke this Lambda Function URL. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.metric">metric</a></code> | Return the given named metric for this Function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.metricDuration">metricDuration</a></code> | How long execution of this Lambda takes. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.metricErrors">metricErrors</a></code> | How many invocations of this Lambda fail. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.metricInvocations">metricInvocations</a></code> | How often this Lambda is invoked. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.metricThrottles">metricThrottles</a></code> | How often this Lambda is throttled. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addAlias">addAlias</a></code> | Defines an alias for this function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addEnvironment">addEnvironment</a></code> | Adds an environment variable to this Lambda function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.addLayers">addLayers</a></code> | Adds one or more Lambda Layers to this Lambda function. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.invalidateVersionBasedOn">invalidateVersionBasedOn</a></code> | Mix additional information into the hash of the Version object. |
---
##### `toString` <a name="toString" id="cdk-nextjs-standalone.NextjsImage.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="cdk-nextjs-standalone.NextjsImage.applyRemovalPolicy"></a>
```typescript
public applyRemovalPolicy(policy: RemovalPolicy): void
```
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops
being managed by CloudFormation, either because you've removed it from the
CDK application or because you've made a change that requires the resource
to be replaced.
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
###### `policy`<sup>Required</sup> <a name="policy" id="cdk-nextjs-standalone.NextjsImage.applyRemovalPolicy.parameter.policy"></a>
- *Type:* aws-cdk-lib.RemovalPolicy
---
##### `addEventSource` <a name="addEventSource" id="cdk-nextjs-standalone.NextjsImage.addEventSource"></a>
```typescript
public addEventSource(source: IEventSource): void
```
Adds an event source to this function.
Event sources are implemented in the aws-cdk-lib/aws-lambda-event-sources module.
The following example adds an SQS Queue as an event source:
```
import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
myFunction.addEventSource(new SqsEventSource(myQueue));
```
###### `source`<sup>Required</sup> <a name="source" id="cdk-nextjs-standalone.NextjsImage.addEventSource.parameter.source"></a>
- *Type:* aws-cdk-lib.aws_lambda.IEventSource
---
##### `addEventSourceMapping` <a name="addEventSourceMapping" id="cdk-nextjs-standalone.NextjsImage.addEventSourceMapping"></a>
```typescript
public addEventSourceMapping(id: string, options: EventSourceMappingOptions): EventSourceMapping
```
Adds an event source that maps to this AWS Lambda function.
###### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsImage.addEventSourceMapping.parameter.id"></a>
- *Type:* string
---
###### `options`<sup>Required</sup> <a name="options" id="cdk-nextjs-standalone.NextjsImage.addEventSourceMapping.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_lambda.EventSourceMappingOptions
---
##### `addFunctionUrl` <a name="addFunctionUrl" id="cdk-nextjs-standalone.NextjsImage.addFunctionUrl"></a>
```typescript
public addFunctionUrl(options?: FunctionUrlOptions): FunctionUrl
```
Adds a url to this lambda function.
###### `options`<sup>Optional</sup> <a name="options" id="cdk-nextjs-standalone.NextjsImage.addFunctionUrl.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_lambda.FunctionUrlOptions
---
##### `addPermission` <a name="addPermission" id="cdk-nextjs-standalone.NextjsImage.addPermission"></a>
```typescript
public addPermission(id: string, permission: Permission): void
```
Adds a permission to the Lambda resource policy.
> [Permission for details.](Permission for details.)
###### `id`<sup>Required</sup> <a name="id" id="cdk-nextjs-standalone.NextjsImage.addPermission.parameter.id"></a>
- *Type:* string
The id for the permission construct.
---
###### `permission`<sup>Required</sup> <a name="permission" id="cdk-nextjs-standalone.NextjsImage.addPermission.parameter.permission"></a>
- *Type:* aws-cdk-lib.aws_lambda.Permission
The permission to grant to this Lambda function.
---
##### `addToRolePolicy` <a name="addToRolePolicy" id="cdk-nextjs-standalone.NextjsImage.addToRolePolicy"></a>
```typescript
public addToRolePolicy(statement: PolicyStatement): void
```
Adds a statement to the IAM role assumed by the instance.
###### `statement`<sup>Required</sup> <a name="statement" id="cdk-nextjs-standalone.NextjsImage.addToRolePolicy.parameter.statement"></a>
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
---
##### `configureAsyncInvoke` <a name="configureAsyncInvoke" id="cdk-nextjs-standalone.NextjsImage.configureAsyncInvoke"></a>
```typescript
public configureAsyncInvoke(options: EventInvokeConfigOptions): void
```
Configures options for asynchronous invocation.
###### `options`<sup>Required</sup> <a name="options" id="cdk-nextjs-standalone.NextjsImage.configureAsyncInvoke.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_lambda.EventInvokeConfigOptions
---
##### `considerWarningOnInvokeFunctionPermissions` <a name="considerWarningOnInvokeFunctionPermissions" id="cdk-nextjs-standalone.NextjsImage.considerWarningOnInvokeFunctionPermissions"></a>
```typescript
public considerWarningOnInvokeFunctionPermissions(scope: Construct, action: string): void
```
A warning will be added to functions under the following conditions: - permissions that include `lambda:InvokeFunction` are added to the unqualified function.
function.currentVersion is invoked before or after the permission is created.
This applies only to permissions on Lambda functions, not versions or aliases.
This function is overridden as a noOp for QualifiedFunctionBase.
###### `scope`<sup>Required</sup> <a name="scope" id="cdk-nextjs-standalone.NextjsImage.considerWarningOnInvokeFunctionPermissions.parameter.scope"></a>
- *Type:* constructs.Construct
---
###### `action`<sup>Required</sup> <a name="action" id="cdk-nextjs-standalone.NextjsImage.considerWarningOnInvokeFunctionPermissions.parameter.action"></a>
- *Type:* string
---
##### `grantInvoke` <a name="grantInvoke" id="cdk-nextjs-standalone.NextjsImage.grantInvoke"></a>
```typescript
public grantInvoke(grantee: IGrantable): Grant
```
Grant the given identity permissions to invoke this Lambda.
###### `grantee`<sup>Required</sup> <a name="grantee" id="cdk-nextjs-standalone.NextjsImage.grantInvoke.parameter.grantee"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
---
##### `grantInvokeCompositePrincipal` <a name="grantInvokeCompositePrincipal" id="cdk-nextjs-standalone.NextjsImage.grantInvokeCompositePrincipal"></a>
```typescript
public grantInvokeCompositePrincipal(compositePrincipal: CompositePrincipal): Grant[]
```
Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
###### `compositePrincipal`<sup>Required</sup> <a name="compositePrincipal" id="cdk-nextjs-standalone.NextjsImage.grantInvokeCompositePrincipal.parameter.compositePrincipal"></a>
- *Type:* aws-cdk-lib.aws_iam.CompositePrincipal
---
##### `grantInvokeUrl` <a name="grantInvokeUrl" id="cdk-nextjs-standalone.NextjsImage.grantInvokeUrl"></a>
```typescript
public grantInvokeUrl(grantee: IGrantable): Grant
```
Grant the given identity permissions to invoke this Lambda Function URL.
###### `grantee`<sup>Required</sup> <a name="grantee" id="cdk-nextjs-standalone.NextjsImage.grantInvokeUrl.parameter.grantee"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
---
##### `metric` <a name="metric" id="cdk-nextjs-standalone.NextjsImage.metric"></a>
```typescript
public metric(metricName: string, props?: MetricOptions): Metric
```
Return the given named metric for this Function.
###### `metricName`<sup>Required</sup> <a name="metricName" id="cdk-nextjs-standalone.NextjsImage.metric.parameter.metricName"></a>
- *Type:* string
---
###### `props`<sup>Optional</sup> <a name="props" id="cdk-nextjs-standalone.NextjsImage.metric.parameter.props"></a>
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
---
##### `metricDuration` <a name="metricDuration" id="cdk-nextjs-standalone.NextjsImage.metricDuration"></a>
```typescript
public metricDuration(props?: MetricOptions): Metric
```
How long execution of this Lambda takes.
Average over 5 minutes
###### `props`<sup>Optional</sup> <a name="props" id="cdk-nextjs-standalone.NextjsImage.metricDuration.parameter.props"></a>
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
---
##### `metricErrors` <a name="metricErrors" id="cdk-nextjs-standalone.NextjsImage.metricErrors"></a>
```typescript
public metricErrors(props?: MetricOptions): Metric
```
How many invocations of this Lambda fail.
Sum over 5 minutes
###### `props`<sup>Optional</sup> <a name="props" id="cdk-nextjs-standalone.NextjsImage.metricErrors.parameter.props"></a>
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
---
##### `metricInvocations` <a name="metricInvocations" id="cdk-nextjs-standalone.NextjsImage.metricInvocations"></a>
```typescript
public metricInvocations(props?: MetricOptions): Metric
```
How often this Lambda is invoked.
Sum over 5 minutes
###### `props`<sup>Optional</sup> <a name="props" id="cdk-nextjs-standalone.NextjsImage.metricInvocations.parameter.props"></a>
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
---
##### `metricThrottles` <a name="metricThrottles" id="cdk-nextjs-standalone.NextjsImage.metricThrottles"></a>
```typescript
public metricThrottles(props?: MetricOptions): Metric
```
How often this Lambda is throttled.
Sum over 5 minutes
###### `props`<sup>Optional</sup> <a name="props" id="cdk-nextjs-standalone.NextjsImage.metricThrottles.parameter.props"></a>
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
---
##### `addAlias` <a name="addAlias" id="cdk-nextjs-standalone.NextjsImage.addAlias"></a>
```typescript
public addAlias(aliasName: string, options?: AliasOptions): Alias
```
Defines an alias for this function.
The alias will automatically be updated to point to the latest version of
the function as it is being updated during a deployment.
```ts
declare const fn: lambda.Function;
fn.addAlias('Live');
// Is equivalent to
new lambda.Alias(this, 'AliasLive', {
aliasName: 'Live',
version: fn.currentVersion,
});
```
###### `aliasName`<sup>Required</sup> <a name="aliasName" id="cdk-nextjs-standalone.NextjsImage.addAlias.parameter.aliasName"></a>
- *Type:* string
The name of the alias.
---
###### `options`<sup>Optional</sup> <a name="options" id="cdk-nextjs-standalone.NextjsImage.addAlias.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_lambda.AliasOptions
Alias options.
---
##### `addEnvironment` <a name="addEnvironment" id="cdk-nextjs-standalone.NextjsImage.addEnvironment"></a>
```typescript
public addEnvironment(key: string, value: string, options?: EnvironmentOptions): Function
```
Adds an environment variable to this Lambda function.
If this is a ref to a Lambda function, this operation results in a no-op.
###### `key`<sup>Required</sup> <a name="key" id="cdk-nextjs-standalone.NextjsImage.addEnvironment.parameter.key"></a>
- *Type:* string
The environment variable key.
---
###### `value`<sup>Required</sup> <a name="value" id="cdk-nextjs-standalone.NextjsImage.addEnvironment.parameter.value"></a>
- *Type:* string
The environment variable's value.
---
###### `options`<sup>Optional</sup> <a name="options" id="cdk-nextjs-standalone.NextjsImage.addEnvironment.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_lambda.EnvironmentOptions
Environment variable options.
---
##### `addLayers` <a name="addLayers" id="cdk-nextjs-standalone.NextjsImage.addLayers"></a>
```typescript
public addLayers(layers: ...ILayerVersion[]): void
```
Adds one or more Lambda Layers to this Lambda function.
###### `layers`<sup>Required</sup> <a name="layers" id="cdk-nextjs-standalone.NextjsImage.addLayers.parameter.layers"></a>
- *Type:* ...aws-cdk-lib.aws_lambda.ILayerVersion[]
the layers to be added.
---
##### `invalidateVersionBasedOn` <a name="invalidateVersionBasedOn" id="cdk-nextjs-standalone.NextjsImage.invalidateVersionBasedOn"></a>
```typescript
public invalidateVersionBasedOn(x: string): void
```
Mix additional information into the hash of the Version object.
The Lambda Function construct does its best to automatically create a new
Version when anything about the Function changes (its code, its layers,
any of the other properties).
However, you can sometimes source information from places that the CDK cannot
look into, like the deploy-time values of SSM parameters. In those cases,
the CDK would not force the creation of a new Version object when it actually
should.
This method can be used to invalidate the current Version object. Pass in
any string into this method, and make sure the string changes when you know
a new Version needs to be created.
This method may be called more than once.
###### `x`<sup>Required</sup> <a name="x" id="cdk-nextjs-standalone.NextjsImage.invalidateVersionBasedOn.parameter.x"></a>
- *Type:* string
---
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.classifyVersionProperty">classifyVersionProperty</a></code> | Record whether specific properties in the `AWS::Lambda::Function` resource should also be associated to the Version resource. |
| <code><a href="#cdk-nextjs-standalone.NextjsImage.fromFunctionArn"