# HttpNlbIntegration

The Network Load Balancer integration resource for HTTP API.

Extends: [HttpRouteIntegration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.HttpRouteIntegration.html) › HttpNlbIntegration

- Source: [`aws-apigatewayv2-integrations/lib/http/nlb.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/nlb.ts#L18)
- Type last changed: v2.114.0 · 5 Dec 2023

## Example

TypeScript:

```ts
import { HttpNlbIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';

const vpc = new ec2.Vpc(this, 'VPC');
const lb = new elbv2.NetworkLoadBalancer(this, 'lb', { vpc });
const listener = lb.addListener('listener', { port: 80 });
listener.addTargets('target', {
  port: 80,
});

const httpEndpoint = new apigwv2.HttpApi(this, 'HttpProxyPrivateApi', {
  defaultIntegration: new HttpNlbIntegration('DefaultIntegration', listener),
});
```

Python:

```python
from aws_cdk.aws_apigatewayv2_integrations import HttpNlbIntegration

vpc = ec2.Vpc(self, "VPC")
lb = elbv2.NetworkLoadBalancer(self, "lb", vpc=vpc)
listener = lb.add_listener("listener", port=80)
listener.add_targets("target",
    port=80
)

http_endpoint = apigwv2.HttpApi(self, "HttpProxyPrivateApi",
    default_integration=HttpNlbIntegration("DefaultIntegration", listener)
)
```

Java:

```java
import software.amazon.awscdk.aws_apigatewayv2_integrations.HttpNlbIntegration;

Vpc vpc = new Vpc(this, "VPC");
NetworkLoadBalancer lb = NetworkLoadBalancer.Builder.create(this, "lb").vpc(vpc).build();
NetworkListener listener = lb.addListener("listener", BaseNetworkListenerProps.builder().port(80).build());
listener.addTargets("target", AddNetworkTargetsProps.builder()
        .port(80)
        .build());

HttpApi httpEndpoint = HttpApi.Builder.create(this, "HttpProxyPrivateApi")
        .defaultIntegration(new HttpNlbIntegration("DefaultIntegration", listener))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AwsApigatewayv2Integrations;

var vpc = new Vpc(this, "VPC");
var lb = new NetworkLoadBalancer(this, "lb", new NetworkLoadBalancerProps { Vpc = vpc });
var listener = lb.AddListener("listener", new BaseNetworkListenerProps { Port = 80 });
listener.AddTargets("target", new AddNetworkTargetsProps {
    Port = 80
});

var httpEndpoint = new HttpApi(this, "HttpProxyPrivateApi", new HttpApiProps {
    DefaultIntegration = new HttpNlbIntegration("DefaultIntegration", listener)
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"

vpc := ec2.NewVpc(this, jsii.String("VPC"))
lb := elbv2.NewNetworkLoadBalancer(this, jsii.String("lb"), &NetworkLoadBalancerProps{
	Vpc: Vpc,
})
listener := lb.AddListener(jsii.String("listener"), &BaseNetworkListenerProps{
	Port: jsii.Number(80),
})
listener.AddTargets(jsii.String("target"), &AddNetworkTargetsProps{
	Port: jsii.Number(80),
})

httpEndpoint := apigwv2.NewHttpApi(this, jsii.String("HttpProxyPrivateApi"), &HttpApiProps{
	DefaultIntegration: awscdk.NewHttpNlbIntegration(jsii.String("DefaultIntegration"), listener),
})
```

## Initializer

TypeScript:

```ts
new HttpNlbIntegration(id: string, listener: INetworkListener, props?: HttpNlbIntegrationProps)
```

Python:

```python
HttpNlbIntegration(id: str, listener: INetworkListener, props: typing.Optional[HttpNlbIntegrationProps] = None)
```

Java:

```java
new HttpNlbIntegration(String id, INetworkListener listener, HttpNlbIntegrationProps props)
```

C# / .NET:

```csharp
new HttpNlbIntegration(string id, INetworkListener listener, HttpNlbIntegrationProps? props = null)
```

Golang:

```go
NewHttpNlbIntegration(Id *string, Listener INetworkListener, Props HttpNlbIntegrationProps)
```

## Methods

- `bind(options: HttpRouteIntegrationBindOptions): HttpRouteIntegrationConfig` — Bind this integration to the route.
