# WebFunctionEndpointGrants

Collection of grant methods for a WebFunction endpoint.

Obtainable from: WebFunctionEndpointGrants.fromWebFunctionEndpoint

- Source: [`aws-lambda/lib/webfunction-endpoint-grants.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/webfunction-endpoint-grants.ts#L7)
- Type last changed: v2.276.0 · 10 Nov 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_lambda as interfaces_lambda } from 'aws-cdk-lib/interfaces';

declare const webFunctionEndpointRef: interfaces_lambda.IWebFunctionEndpointRef;
const webFunctionEndpointGrants = lambda.WebFunctionEndpointGrants.fromWebFunctionEndpoint(webFunctionEndpointRef);
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lambda as lambda_
from aws_cdk.interfaces import aws_lambda as interfaces_lambda

# web_function_endpoint_ref: interfaces_lambda.IWebFunctionEndpointRef

web_function_endpoint_grants = lambda_.WebFunctionEndpointGrants.from_web_function_endpoint(web_function_endpoint_ref)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.interfaces.lambda.*;

IWebFunctionEndpointRef webFunctionEndpointRef;

WebFunctionEndpointGrants webFunctionEndpointGrants = WebFunctionEndpointGrants.fromWebFunctionEndpoint(webFunctionEndpointRef);
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK.Interfaces.Lambda;

IWebFunctionEndpointRef webFunctionEndpointRef;

var webFunctionEndpointGrants = WebFunctionEndpointGrants.FromWebFunctionEndpoint(webFunctionEndpointRef);
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var webFunctionEndpointRef IWebFunctionEndpointRef

webFunctionEndpointGrants := awscdk.Aws_lambda.WebFunctionEndpointGrants_FromWebFunctionEndpoint(webFunctionEndpointRef)
```

## Methods

- `fromWebFunctionEndpoint(endpoint: IWebFunctionEndpointRef): WebFunctionEndpointGrants // chainable` (static) — Creates grants for a WebFunction endpoint.

- `invoke(grantee: IGrantable): Grant` — Grants permission to invoke the endpoint over HTTP.

  Only meaningful for an endpoint with `WebFunctionAuthType.IAM_AUTH`; requests to it must be
  signed by the grantee.

  A role or user in this account gets the permission in its own policy. Any other grantee, such
  as a service principal or another account, gets a statement in the resource-based policy of
  the WebFunction the endpoint serves, which requires that function to be defined in this app.
