@liflig/cdk
    Preparing search index...

    Type Alias AlbIntegrationProps

    Props for the API-GW -> ALB (Application Load Balancer) integration.

    See the note on ApiGateway about the load balancer security group.

    type AlbIntegrationProps = {
        hostName: string;
        loadBalancerListener: elb.IApplicationListener;
        mapParameters?: (parameters: apigw.ParameterMapping) => void;
        securityGroup: ec2.ISecurityGroup;
        vpc: ec2.IVpc;
    }
    Index

    Properties

    hostName: string

    The host name (domain name) of the backend service that we want to reach through the ALB.

    This is used to:

    • Verify the HTTPS certificate of the backend service, so that the request forwarded from API-GW can use TLS
    • Set the Host header on the request when forwarding to the ALB, so that requests can be routed to the correct Target Group

    Example value: <service>.staging.my-project.liflig.io (not prefixed by https://).

    loadBalancerListener: elb.IApplicationListener

    A listener on e.g. port 443 (HTTPS).

    See the note on ApiGateway about the load balancer security group.

    mapParameters?: (parameters: apigw.ParameterMapping) => void

    Map request parameters (add/overwrite path/headers/query params) before forwarding to the backend.

    See https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html for more on this. Read the 'Reserved headers' section for which headers cannot be overridden. In addition to the AWS-reserved headers, you should not override the 'Host' header either, as that's used for routing the request to the correct service behind the load balancer.

    Adding a header:

    mapParameters: (parameters) => parameters.overwriteHeader(
    "X-My-Custom-Header",
    apigw.MappingValue.custom("my-custom-value"),
    )

    Overwriting the path (if, for example, you configure a /users route on the API Gateway that you want to forward to /api/users on the backend):

    mapParameters: (parameters) => parameters.overwritePath("/api/users")
    
    securityGroup: ec2.ISecurityGroup

    A security group (SG) that allows incoming traffic to the ALB. Will be used by the VPC link, so the API-GW integration can connect.

    This is usually the same SG as the ALB uses, because they have a rule that allows traffic from others in the same SG.

    See the note on ApiGateway about the load balancer security group.

    vpc: ec2.IVpc

    The VPC used by the ALB. The API-GW integration will connect to the ALB using a VPC Link for this VPC.

    See the note on ApiGateway about the load balancer security group.