# WebFunctionEndpoint

An endpoint of a Lambda WebFunction: a domain that serves HTTP traffic for one of the function's revisions.

A `WebFunction` creates one, `fn.endpoint`. Create more with `fn.addEndpoint()`, for example
to serve the same function with a different auth type or endpoint type.

Extends: Construct › Resource › WebFunctionEndpointBase › WebFunctionEndpoint
Implements: IResource, IResourceWithPolicyV2, IWebFunctionEndpoint, IEnvironmentAware, IWebFunctionEndpointRef, IConstruct, IDependable

- CloudFormation: [`AWS::Lambda::WebFunctionEndpoint`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-lambda-webfunctionendpoint.html)
- L1 type: [`CfnWebFunctionEndpoint`](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.CfnWebFunctionEndpoint.html)
- Source: [`aws-lambda/lib/webfunction-endpoint.ts`](https://github.com/aws/aws-cdk/blob/v2.276.0/packages/aws-cdk-lib/aws-lambda/lib/webfunction-endpoint.ts#L407)
- Type last changed: v2.276.0 · 10 Nov 2026

## Example

```ts
declare const fn: lambda.WebFunction;

const internal = fn.addEndpoint('Internal', {
  authType: lambda.WebFunctionAuthType.IAM_AUTH,
});
```

## Initializer

```ts
new WebFunctionEndpoint(scope: Construct, id: string, props: WebFunctionEndpointProps)
```

## Construct Props

- `authType`: [WebFunctionAuthType](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionAuthType.html) (required) — The authentication type for the WebFunction endpoint.

  There is no default: you must choose explicitly so an endpoint is never accidentally public or
  accidentally locked down. Specify `WebFunctionAuthType.IAM_AUTH` (Lambda authorizes requests with SigV4/IAM)
  or `WebFunctionAuthType.APPLICATION_MANAGED` (the endpoint is public and your function handles authorization).

  With `IAM_AUTH`, requests must be signed with SigV4 and carry the `X-Amz-Content-SHA256`
  header, also for a request without a body; without it the endpoint returns 403 even for a
  valid signature. A `MULTI_REGION` endpoint is signed with SigV4a, for the Region set `*`.

- `endpointDescription`: string — A description of the endpoint.

  **Default:** No description.

  Up to 256 characters.

- `endpointLocation`: [WebFunctionEndpointLocation](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionEndpointLocation.html) — Where the endpoint serves traffic: the home Region only, or a set of replica Regions.

  **Default:** WebFunctionEndpointLocation.homeRegion()

  Changing it replaces the endpoint, which yields a new `domainName`. If you set
  `endpointName`, change it at the same time.

- `endpointName`: string — The name of the WebFunction endpoint.

  **Default:** for the endpoint a WebFunction creates, `prod` in the home Region and, for a regional endpoint, `prod-` followed by a hash of its location; for any other endpoint, a name derived from its construct path and location

  Must be 2 to 64 characters of letters, numbers, hyphens or underscores, starting and
  ending with a letter or number.

  Changing this property replaces the endpoint, which yields a new `domainName`.

  `endpointLocation` also replaces the endpoint when it changes, and CloudFormation cannot
  replace a resource that keeps its name. Without this property the name is derived from the
  location, so that works. With it, change the name together with the location, or the
  deployment fails.

- `maxEnvironments`: number — The maximum number of concurrent execution environments for the endpoint.

  **Default:** Scaling is limited only by your account's vCPU quota.

  This is an optional cap on top of your account's vCPU quota, not a reservation:
  it further constrains how far the endpoint scales. Must be 2 or greater.

- `rateLimit`: number — The maximum request rate per second for the endpoint, up to 10000.

  **Default:** The request rate is limited only by your account's rate limit quota.

  This is an optional cap on top of your account's rate limit quota. Specify 0 to
  reject all new requests.

  The service accepts only certain values: 0, 100 through 1000 in increments of 100,
  and 2000 through 10000 in increments of 1000. Which of those are available varies by
  Region, and an unsupported value is rejected at deploy time with the values that
  Region does accept. Only the lower bound is checked at synth, since the schema
  declares nothing more.

- `traffic`: [WebFunctionTraffic](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionTraffic.html) (required) — The revisions that receive the endpoint's traffic.

  For a `WebFunction` defined in this app, `WebFunction.addEndpoint()` sets this to the
  function's revision.

- `webFunction`: [IWebFunctionRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef.html) (required) — The WebFunction the endpoint serves.

## Properties

- `authType`: [WebFunctionAuthType](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionAuthType.html) — How the endpoint authenticates requests.

- `domainName`: string — The domain name of the endpoint: the host clients send requests to.

- `endpointArn`: string — The ARN of the endpoint.

- `endpointType`: [WebFunctionEndpointType](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionEndpointType.html) — The endpoint type.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `grants`: [WebFunctionEndpointGrants](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.WebFunctionEndpointGrants.html) — Grant methods for the endpoint.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `resource`: [CfnWebFunctionEndpoint](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.CfnWebFunctionEndpoint.html) — The underlying L1 CfnWebFunctionEndpoint resource.

  Use for escape hatches.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `webFunctionArn`: string — The ARN of the WebFunction the endpoint serves.

- `webFunctionEndpointRef`: [WebFunctionEndpointReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_lambda.WebFunctionEndpointReference.html) — A reference to a WebFunctionEndpoint resource.

## Methods

- `addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult` — Adds a statement to the resource-based policy of the WebFunction the endpoint serves.

  For an endpoint in another stack than its function, the statement names the endpoint by the
  function's ARN and the endpoint name, so the name must be a literal.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `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`).

- `fromWebFunctionEndpointAttributes(scope: Construct, id: string, attrs: WebFunctionEndpointAttributes): IWebFunctionEndpoint` (static) — Import an existing WebFunction endpoint by its attributes.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `isWebFunctionEndpoint(x: any): boolean` (static) — Return whether the given object is a WebFunctionEndpoint.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
