Skip to content
v2.278.0

CfnListenerProps Struct ​

Properties for defining a CfnListener.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';
const cfnListenerProps: elbv2.CfnListenerProps = {
  defaultActions: [{
    type: 'type',

    // the properties below are optional
    authenticateCognitoConfig: {
      userPoolArn: 'userPoolArn',
      userPoolClientId: 'userPoolClientId',
      userPoolDomain: 'userPoolDomain',

      // the properties below are optional
      authenticationRequestExtraParams: {
        authenticationRequestExtraParamsKey: 'authenticationRequestExtraParams',
      },
      onUnauthenticatedRequest: 'onUnauthenticatedRequest',
      scope: 'scope',
      sessionCookieName: 'sessionCookieName',
      sessionTimeout: 'sessionTimeout',
    },
    authenticateOidcConfig: {
      authorizationEndpoint: 'authorizationEndpoint',
      clientId: 'clientId',
      issuer: 'issuer',
      tokenEndpoint: 'tokenEndpoint',
      userInfoEndpoint: 'userInfoEndpoint',

      // the properties below are optional
      authenticationRequestExtraParams: {
        authenticationRequestExtraParamsKey: 'authenticationRequestExtraParams',
      },
      clientSecret: 'clientSecret',
      onUnauthenticatedRequest: 'onUnauthenticatedRequest',
      scope: 'scope',
      sessionCookieName: 'sessionCookieName',
      sessionTimeout: 'sessionTimeout',
      useExistingClientSecret: false,
    },
    fixedResponseConfig: {
      statusCode: 'statusCode',

      // the properties below are optional
      contentType: 'contentType',
      messageBody: 'messageBody',
    },
    forwardConfig: {
      targetGroups: [{
        targetGroupArn: 'targetGroupArn',
        weight: 123,
      }],
      targetGroupStickinessConfig: {
        durationSeconds: 123,
        enabled: false,
      },
    },
    jwtValidationConfig: {
      issuer: 'issuer',
      jwksEndpoint: 'jwksEndpoint',

      // the properties below are optional
      additionalClaims: [{
        format: 'format',
        name: 'name',
        values: ['values'],
      }],
    },
    order: 123,
    redirectConfig: {
      statusCode: 'statusCode',

      // the properties below are optional
      host: 'host',
      path: 'path',
      port: 'port',
      protocol: 'protocol',
      query: 'query',
    },
    targetGroupArn: 'targetGroupArn',
  }],
  loadBalancerArn: 'loadBalancerArn',

  // the properties below are optional
  alpnPolicy: ['alpnPolicy'],
  certificates: [{
    certificateArn: 'certificateArn',
  }],
  listenerAttributes: [{
    key: 'key',
    value: 'value',
  }],
  mutualAuthentication: {
    advertiseTrustStoreCaNames: 'advertiseTrustStoreCaNames',
    ignoreClientCertificateExpiry: false,
    mode: 'mode',
    trustStoreArn: 'trustStoreArn',
  },
  port: 123,
  protocol: 'protocol',
  sslPolicy: 'sslPolicy',
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticloadbalancingv2 as elbv2

cfn_listener_props = elbv2.CfnListenerProps(
    default_actions=[elbv2.CfnListener.ActionProperty(
        type="type",

        # the properties below are optional
        authenticate_cognito_config=elbv2.CfnListener.AuthenticateCognitoConfigProperty(
            user_pool_arn="userPoolArn",
            user_pool_client_id="userPoolClientId",
            user_pool_domain="userPoolDomain",

            # the properties below are optional
            authentication_request_extra_params={
                "authentication_request_extra_params_key": "authenticationRequestExtraParams"
            },
            on_unauthenticated_request="onUnauthenticatedRequest",
            scope="scope",
            session_cookie_name="sessionCookieName",
            session_timeout="sessionTimeout"
        ),
        authenticate_oidc_config=elbv2.CfnListener.AuthenticateOidcConfigProperty(
            authorization_endpoint="authorizationEndpoint",
            client_id="clientId",
            issuer="issuer",
            token_endpoint="tokenEndpoint",
            user_info_endpoint="userInfoEndpoint",

            # the properties below are optional
            authentication_request_extra_params={
                "authentication_request_extra_params_key": "authenticationRequestExtraParams"
            },
            client_secret="clientSecret",
            on_unauthenticated_request="onUnauthenticatedRequest",
            scope="scope",
            session_cookie_name="sessionCookieName",
            session_timeout="sessionTimeout",
            use_existing_client_secret=False
        ),
        fixed_response_config=elbv2.CfnListener.FixedResponseConfigProperty(
            status_code="statusCode",

            # the properties below are optional
            content_type="contentType",
            message_body="messageBody"
        ),
        forward_config=elbv2.CfnListener.ForwardConfigProperty(
            target_groups=[elbv2.CfnListener.TargetGroupTupleProperty(
                target_group_arn="targetGroupArn",
                weight=123
            )],
            target_group_stickiness_config=elbv2.CfnListener.TargetGroupStickinessConfigProperty(
                duration_seconds=123,
                enabled=False
            )
        ),
        jwt_validation_config=elbv2.CfnListener.JwtValidationConfigProperty(
            issuer="issuer",
            jwks_endpoint="jwksEndpoint",

            # the properties below are optional
            additional_claims=[elbv2.CfnListener.JwtValidationActionAdditionalClaimProperty(
                format="format",
                name="name",
                values=["values"]
            )]
        ),
        order=123,
        redirect_config=elbv2.CfnListener.RedirectConfigProperty(
            status_code="statusCode",

            # the properties below are optional
            host="host",
            path="path",
            port="port",
            protocol="protocol",
            query="query"
        ),
        target_group_arn="targetGroupArn"
    )],
    load_balancer_arn="loadBalancerArn",

    # the properties below are optional
    alpn_policy=["alpnPolicy"],
    certificates=[elbv2.CfnListener.CertificateProperty(
        certificate_arn="certificateArn"
    )],
    listener_attributes=[elbv2.CfnListener.ListenerAttributeProperty(
        key="key",
        value="value"
    )],
    mutual_authentication=elbv2.CfnListener.MutualAuthenticationProperty(
        advertise_trust_store_ca_names="advertiseTrustStoreCaNames",
        ignore_client_certificate_expiry=False,
        mode="mode",
        trust_store_arn="trustStoreArn"
    ),
    port=123,
    protocol="protocol",
    ssl_policy="sslPolicy",
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
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.elasticloadbalancingv2.*;

CfnListenerProps cfnListenerProps = CfnListenerProps.builder()
        .defaultActions(List.of(ActionProperty.builder()
                .type("type")

                // the properties below are optional
                .authenticateCognitoConfig(AuthenticateCognitoConfigProperty.builder()
                        .userPoolArn("userPoolArn")
                        .userPoolClientId("userPoolClientId")
                        .userPoolDomain("userPoolDomain")

                        // the properties below are optional
                        .authenticationRequestExtraParams(Map.of(
                                "authenticationRequestExtraParamsKey", "authenticationRequestExtraParams"))
                        .onUnauthenticatedRequest("onUnauthenticatedRequest")
                        .scope("scope")
                        .sessionCookieName("sessionCookieName")
                        .sessionTimeout("sessionTimeout")
                        .build())
                .authenticateOidcConfig(AuthenticateOidcConfigProperty.builder()
                        .authorizationEndpoint("authorizationEndpoint")
                        .clientId("clientId")
                        .issuer("issuer")
                        .tokenEndpoint("tokenEndpoint")
                        .userInfoEndpoint("userInfoEndpoint")

                        // the properties below are optional
                        .authenticationRequestExtraParams(Map.of(
                                "authenticationRequestExtraParamsKey", "authenticationRequestExtraParams"))
                        .clientSecret("clientSecret")
                        .onUnauthenticatedRequest("onUnauthenticatedRequest")
                        .scope("scope")
                        .sessionCookieName("sessionCookieName")
                        .sessionTimeout("sessionTimeout")
                        .useExistingClientSecret(false)
                        .build())
                .fixedResponseConfig(FixedResponseConfigProperty.builder()
                        .statusCode("statusCode")

                        // the properties below are optional
                        .contentType("contentType")
                        .messageBody("messageBody")
                        .build())
                .forwardConfig(ForwardConfigProperty.builder()
                        .targetGroups(List.of(TargetGroupTupleProperty.builder()
                                .targetGroupArn("targetGroupArn")
                                .weight(123)
                                .build()))
                        .targetGroupStickinessConfig(TargetGroupStickinessConfigProperty.builder()
                                .durationSeconds(123)
                                .enabled(false)
                                .build())
                        .build())
                .jwtValidationConfig(JwtValidationConfigProperty.builder()
                        .issuer("issuer")
                        .jwksEndpoint("jwksEndpoint")

                        // the properties below are optional
                        .additionalClaims(List.of(JwtValidationActionAdditionalClaimProperty.builder()
                                .format("format")
                                .name("name")
                                .values(List.of("values"))
                                .build()))
                        .build())
                .order(123)
                .redirectConfig(RedirectConfigProperty.builder()
                        .statusCode("statusCode")

                        // the properties below are optional
                        .host("host")
                        .path("path")
                        .port("port")
                        .protocol("protocol")
                        .query("query")
                        .build())
                .targetGroupArn("targetGroupArn")
                .build()))
        .loadBalancerArn("loadBalancerArn")

        // the properties below are optional
        .alpnPolicy(List.of("alpnPolicy"))
        .certificates(List.of(CertificateProperty.builder()
                .certificateArn("certificateArn")
                .build()))
        .listenerAttributes(List.of(ListenerAttributeProperty.builder()
                .key("key")
                .value("value")
                .build()))
        .mutualAuthentication(MutualAuthenticationProperty.builder()
                .advertiseTrustStoreCaNames("advertiseTrustStoreCaNames")
                .ignoreClientCertificateExpiry(false)
                .mode("mode")
                .trustStoreArn("trustStoreArn")
                .build())
        .port(123)
        .protocol("protocol")
        .sslPolicy("sslPolicy")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
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.ElasticLoadBalancingV2;

var cfnListenerProps = new CfnListenerProps {
    DefaultActions = new [] { new ActionProperty {
        Type = "type",

        // the properties below are optional
        AuthenticateCognitoConfig = new AuthenticateCognitoConfigProperty {
            UserPoolArn = "userPoolArn",
            UserPoolClientId = "userPoolClientId",
            UserPoolDomain = "userPoolDomain",

            // the properties below are optional
            AuthenticationRequestExtraParams = new Dictionary<string, string> {
                { "authenticationRequestExtraParamsKey", "authenticationRequestExtraParams" }
            },
            OnUnauthenticatedRequest = "onUnauthenticatedRequest",
            Scope = "scope",
            SessionCookieName = "sessionCookieName",
            SessionTimeout = "sessionTimeout"
        },
        AuthenticateOidcConfig = new AuthenticateOidcConfigProperty {
            AuthorizationEndpoint = "authorizationEndpoint",
            ClientId = "clientId",
            Issuer = "issuer",
            TokenEndpoint = "tokenEndpoint",
            UserInfoEndpoint = "userInfoEndpoint",

            // the properties below are optional
            AuthenticationRequestExtraParams = new Dictionary<string, string> {
                { "authenticationRequestExtraParamsKey", "authenticationRequestExtraParams" }
            },
            ClientSecret = "clientSecret",
            OnUnauthenticatedRequest = "onUnauthenticatedRequest",
            Scope = "scope",
            SessionCookieName = "sessionCookieName",
            SessionTimeout = "sessionTimeout",
            UseExistingClientSecret = false
        },
        FixedResponseConfig = new FixedResponseConfigProperty {
            StatusCode = "statusCode",

            // the properties below are optional
            ContentType = "contentType",
            MessageBody = "messageBody"
        },
        ForwardConfig = new ForwardConfigProperty {
            TargetGroups = new [] { new TargetGroupTupleProperty {
                TargetGroupArn = "targetGroupArn",
                Weight = 123
            } },
            TargetGroupStickinessConfig = new TargetGroupStickinessConfigProperty {
                DurationSeconds = 123,
                Enabled = false
            }
        },
        JwtValidationConfig = new JwtValidationConfigProperty {
            Issuer = "issuer",
            JwksEndpoint = "jwksEndpoint",

            // the properties below are optional
            AdditionalClaims = new [] { new JwtValidationActionAdditionalClaimProperty {
                Format = "format",
                Name = "name",
                Values = new [] { "values" }
            } }
        },
        Order = 123,
        RedirectConfig = new RedirectConfigProperty {
            StatusCode = "statusCode",

            // the properties below are optional
            Host = "host",
            Path = "path",
            Port = "port",
            Protocol = "protocol",
            Query = "query"
        },
        TargetGroupArn = "targetGroupArn"
    } },
    LoadBalancerArn = "loadBalancerArn",

    // the properties below are optional
    AlpnPolicy = new [] { "alpnPolicy" },
    Certificates = new [] { new CertificateProperty {
        CertificateArn = "certificateArn"
    } },
    ListenerAttributes = new [] { new ListenerAttributeProperty {
        Key = "key",
        Value = "value"
    } },
    MutualAuthentication = new MutualAuthenticationProperty {
        AdvertiseTrustStoreCaNames = "advertiseTrustStoreCaNames",
        IgnoreClientCertificateExpiry = false,
        Mode = "mode",
        TrustStoreArn = "trustStoreArn"
    },
    Port = 123,
    Protocol = "protocol",
    SslPolicy = "sslPolicy",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
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"

cfnListenerProps := &CfnListenerProps{
	DefaultActions: []interface{}{
		&ActionProperty{
			Type: jsii.String("type"),

			// the properties below are optional
			AuthenticateCognitoConfig: &AuthenticateCognitoConfigProperty{
				UserPoolArn: jsii.String("userPoolArn"),
				UserPoolClientId: jsii.String("userPoolClientId"),
				UserPoolDomain: jsii.String("userPoolDomain"),

				// the properties below are optional
				AuthenticationRequestExtraParams: map[string]*string{
					"authenticationRequestExtraParamsKey": jsii.String("authenticationRequestExtraParams"),
				},
				OnUnauthenticatedRequest: jsii.String("onUnauthenticatedRequest"),
				Scope: jsii.String("scope"),
				SessionCookieName: jsii.String("sessionCookieName"),
				SessionTimeout: jsii.String("sessionTimeout"),
			},
			AuthenticateOidcConfig: &AuthenticateOidcConfigProperty{
				AuthorizationEndpoint: jsii.String("authorizationEndpoint"),
				ClientId: jsii.String("clientId"),
				Issuer: jsii.String("issuer"),
				TokenEndpoint: jsii.String("tokenEndpoint"),
				UserInfoEndpoint: jsii.String("userInfoEndpoint"),

				// the properties below are optional
				AuthenticationRequestExtraParams: map[string]*string{
					"authenticationRequestExtraParamsKey": jsii.String("authenticationRequestExtraParams"),
				},
				ClientSecret: jsii.String("clientSecret"),
				OnUnauthenticatedRequest: jsii.String("onUnauthenticatedRequest"),
				Scope: jsii.String("scope"),
				SessionCookieName: jsii.String("sessionCookieName"),
				SessionTimeout: jsii.String("sessionTimeout"),
				UseExistingClientSecret: jsii.Boolean(false),
			},
			FixedResponseConfig: &FixedResponseConfigProperty{
				StatusCode: jsii.String("statusCode"),

				// the properties below are optional
				ContentType: jsii.String("contentType"),
				MessageBody: jsii.String("messageBody"),
			},
			ForwardConfig: &ForwardConfigProperty{
				TargetGroups: []interface{}{
					&TargetGroupTupleProperty{
						TargetGroupArn: jsii.String("targetGroupArn"),
						Weight: jsii.Number(123),
					},
				},
				TargetGroupStickinessConfig: &TargetGroupStickinessConfigProperty{
					DurationSeconds: jsii.Number(123),
					Enabled: jsii.Boolean(false),
				},
			},
			JwtValidationConfig: &JwtValidationConfigProperty{
				Issuer: jsii.String("issuer"),
				JwksEndpoint: jsii.String("jwksEndpoint"),

				// the properties below are optional
				AdditionalClaims: []interface{}{
					&JwtValidationActionAdditionalClaimProperty{
						Format: jsii.String("format"),
						Name: jsii.String("name"),
						Values: []*string{
							jsii.String("values"),
						},
					},
				},
			},
			Order: jsii.Number(123),
			RedirectConfig: &RedirectConfigProperty{
				StatusCode: jsii.String("statusCode"),

				// the properties below are optional
				Host: jsii.String("host"),
				Path: jsii.String("path"),
				Port: jsii.String("port"),
				Protocol: jsii.String("protocol"),
				Query: jsii.String("query"),
			},
			TargetGroupArn: jsii.String("targetGroupArn"),
		},
	},
	LoadBalancerArn: jsii.String("loadBalancerArn"),

	// the properties below are optional
	AlpnPolicy: []*string{
		jsii.String("alpnPolicy"),
	},
	Certificates: []interface{}{
		&CertificateProperty{
			CertificateArn: jsii.String("certificateArn"),
		},
	},
	ListenerAttributes: []interface{}{
		&ListenerAttributeProperty{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	MutualAuthentication: &MutualAuthenticationProperty{
		AdvertiseTrustStoreCaNames: jsii.String("advertiseTrustStoreCaNames"),
		IgnoreClientCertificateExpiry: jsii.Boolean(false),
		Mode: jsii.String("mode"),
		TrustStoreArn: jsii.String("trustStoreArn"),
	},
	Port: jsii.Number(123),
	Protocol: jsii.String("protocol"),
	SslPolicy: jsii.String("sslPolicy"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

Properties ​

alpnPolicyoptionalstring[]alpn_policyoptionaltyping.List[str]alpnPolicyoptionalList<String>AlpnPolicyoptionalstring[]AlpnPolicyoptional*[]*string #
[TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.
certificatesoptionalIResolvable | IResolvable | CfnListener.CertificateProperty[]certificatesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, CertificateProperty]]]certificatesoptionalIResolvableCertificatesoptionalIResolvableCertificatesoptionalinterface{} #
The default SSL server certificate for a secure listener.
notes

You must provide exactly one certificate if the listener protocol is HTTPS or TLS.

For an HTTPS listener, update requires some interruptions. For a TLS listener, update requires no interruption.

To create a certificate list for a secure listener, use AWS::ElasticLoadBalancingV2::ListenerCertificate .

defaultActionsIResolvable | IResolvable | CfnListener.ActionProperty[]default_actionstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ActionProperty]]]defaultActionsIResolvableDefaultActionsIResolvableDefaultActionsinterface{} required #
The actions for the default rule. You cannot define a condition for a default rule.

To create additional rules for an Application Load Balancer, use AWS::ElasticLoadBalancingV2::ListenerRule .

listenerAttributesoptionalIResolvable | IResolvable | CfnListener.ListenerAttributeProperty[]listener_attributesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ListenerAttributeProperty]]]listenerAttributesoptionalIResolvableListenerAttributesoptionalIResolvableListenerAttributesoptionalinterface{} #
The listener attributes.

Attributes that you do not modify retain their current values.

loadBalancerArnstring | ILoadBalancerRefload_balancer_arntyping.Union[str, ILoadBalancerRef]loadBalancerArnStringLoadBalancerArnstringLoadBalancerArninterface{} required #
The Amazon Resource Name (ARN) of the load balancer.
mutualAuthenticationoptionalIResolvable | CfnListener.MutualAuthenticationPropertymutual_authenticationoptionaltyping.Union[IResolvable, MutualAuthenticationProperty]mutualAuthenticationoptionalIResolvableMutualAuthenticationoptionalIResolvableMutualAuthenticationoptionalinterface{} #
The mutual authentication configuration information.
portoptionalnumberportoptionalint | floatportoptionalNumberPortoptionaldoublePortoptional*float64 #
The port on which the load balancer is listening.

You can't specify a port for a Gateway Load Balancer.

protocoloptionalstringprotocoloptionalstrprotocoloptionalStringProtocoloptionalstringProtocoloptional*string #
The protocol for connections from clients to the load balancer.
notes

For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, TCP_UDP, QUIC, and TCP_QUIC. You can’t specify the UDP, TCP_UDP, QUIC, or TCP_QUIC protocol if dual-stack mode is enabled. You can't specify a protocol for a Gateway Load Balancer.

sslPolicyoptionalstringssl_policyoptionalstrsslPolicyoptionalStringSslPolicyoptionalstringSslPolicyoptional*string #
[HTTPS and TLS listeners] The security policy that defines which protocols and ciphers are supported.
notes

For more information, see Security policies in the Application Load Balancers Guide and Security policies in the Network Load Balancers Guide .

[HTTPS listeners] Updating the security policy can result in interruptions if the load balancer is handling a high volume of traffic. To decrease the possibility of an interruption if your load balancer is handling a high volume of traffic, create an additional load balancer or request an LCU reservation.

tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #