Skip to content
v2.275.0

HttpUrlIntegration Class ​

The HTTP Proxy integration resource for HTTP API.

Example ​

ts
import { HttpJwtAuthorizer } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
import { HttpUrlIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';

const issuer = 'https://test.us.auth0.com';
const authorizer = new HttpJwtAuthorizer('BooksAuthorizer', issuer, {
  jwtAudience: ['3131231'],
});

const api = new apigwv2.HttpApi(this, 'HttpApi');

api.addRoutes({
  integration: new HttpUrlIntegration('BooksIntegration', 'https://get-books-proxy.example.com'),
  path: '/books',
  authorizer,
});
python
from aws_cdk.aws_apigatewayv2_authorizers import HttpJwtAuthorizer
from aws_cdk.aws_apigatewayv2_integrations import HttpUrlIntegration


issuer = "https://test.us.auth0.com"
authorizer = HttpJwtAuthorizer("BooksAuthorizer", issuer,
    jwt_audience=["3131231"]
)

api = apigwv2.HttpApi(self, "HttpApi")

api.add_routes(
    integration=HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.example.com"),
    path="/books",
    authorizer=authorizer
)
java
import software.amazon.awscdk.aws_apigatewayv2_authorizers.HttpJwtAuthorizer;
import software.amazon.awscdk.aws_apigatewayv2_integrations.HttpUrlIntegration;


String issuer = "https://test.us.auth0.com";
HttpJwtAuthorizer authorizer = HttpJwtAuthorizer.Builder.create("BooksAuthorizer", issuer)
        .jwtAudience(List.of("3131231"))
        .build();

HttpApi api = new HttpApi(this, "HttpApi");

api.addRoutes(AddRoutesOptions.builder()
        .integration(new HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.example.com"))
        .path("/books")
        .authorizer(authorizer)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AwsApigatewayv2Authorizers;
using Amazon.CDK.AwsApigatewayv2Integrations;


var issuer = "https://test.us.auth0.com";
var authorizer = new HttpJwtAuthorizer("BooksAuthorizer", issuer, new HttpJwtAuthorizerProps {
    JwtAudience = new [] { "3131231" }
});

var api = new HttpApi(this, "HttpApi");

api.AddRoutes(new AddRoutesOptions {
    Integration = new HttpUrlIntegration("BooksIntegration", "https://get-books-proxy.example.com"),
    Path = "/books",
    Authorizer = authorizer
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"


issuer := "https://test.us.auth0.com"
authorizer := awscdk.NewHttpJwtAuthorizer(jsii.String("BooksAuthorizer"), issuer, &HttpJwtAuthorizerProps{
	JwtAudience: []*string{
		jsii.String("3131231"),
	},
})

api := apigwv2.NewHttpApi(this, jsii.String("HttpApi"))

api.AddRoutes(&AddRoutesOptions{
	Integration: awscdk.NewHttpUrlIntegration(jsii.String("BooksIntegration"), jsii.String("https://get-books-proxy.example.com")),
	Path: jsii.String("/books"),
	Authorizer: Authorizer,
})

Initializer ​

ts
new HttpUrlIntegration(id: string, url: string, props?: HttpUrlIntegrationProps)
python
HttpUrlIntegration(id: str, url: str, props: typing.Optional[HttpUrlIntegrationProps] = None)
java
new HttpUrlIntegration(String id, String url, HttpUrlIntegrationProps props)
csharp
new HttpUrlIntegration(string id, string url, HttpUrlIntegrationProps? props = null)
go
NewHttpUrlIntegration(Id *string, Url *string, Props HttpUrlIntegrationProps)

Methods ​

bind(_options: HttpRouteIntegrationBindOptions): HttpRouteIntegrationConfigdef bind(self, _options: HttpRouteIntegrationBindOptions) -> HttpRouteIntegrationConfigpublic HttpRouteIntegrationConfig bind(HttpRouteIntegrationBindOptions _options)public HttpRouteIntegrationConfig Bind(HttpRouteIntegrationBindOptions _options)func Bind(_options HttpRouteIntegrationBindOptions) HttpRouteIntegrationConfig#
Bind this integration to the route.