For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/ApplicationLoadBalancer.html[aws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancer]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/ApplicationListener.html[aws_cdk.aws_elasticloadbalancingv2.ApplicationListener]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/NetworkLoadBalancer.html[aws_cdk.aws_elasticloadbalancingv2.NetworkLoadBalancer]:
[source,python]
----
from aws_cdk import (
aws_elasticloadbalancingv2 as elbv2,
)
lb = elbv2.NetworkLoadBalancer(
self,
"LB",
vpc=vpc,
internet_facing=True
)
lb.add_listener( # Sensitive
"Listener-default",
port=1234
)
lb.add_listener(
"Listener-TCP-explicit",
protocol=elbv2.Protocol.TCP, # Sensitive
port=1337
)
----
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/NetworkListener.html[aws_cdk.aws_elasticloadbalancingv2.NetworkListener]:
[source,python]
----
from aws_cdk import (
aws_elasticloadbalancingv2 as elbv2,
)
elbv2.NetworkListener(
self,
"Listener-TCP-explicit",
protocol=elbv2.Protocol.TCP, # Sensitive
port=1338,
load_balancer=lb
)
----
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/CfnListener.html[aws_cdk.aws_elasticloadbalancingv2.CfnListener]:
[source,python]
----
from aws_cdk import (
aws_elasticloadbalancingv2 as elbv2,
)
elbv2.CfnListener(
self,
"listener-http",
default_actions=[application_default_action],
load_balancer_arn=lb.load_balancer_arn,
protocol="HTTP", # Sensitive
port=80
)
elbv2.CfnListener(
self,
"listener-tcp",
default_actions=[network_default_action],
load_balancer_arn=lb.load_balancer_arn,
protocol="TCP", # Sensitive
port=1000
)
----
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancing/LoadBalancerListener.html[aws_cdk.aws_elasticloadbalancing.LoadBalancerListener]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancing/CfnLoadBalancer.html[aws_cdk.aws_elasticloadbalancing.CfnLoadBalancer]:
[source, python]
----
from aws_cdk import (
aws_elasticloadbalancing as elb
)
elb.CfnLoadBalancer(
self,
"elb-tcp",
listeners=[
elb.CfnLoadBalancer.ListenersProperty(
instance_port="10000",
load_balancer_port="10000",
protocol="tcp" # Sensitive
)
],
subnets=vpc.select_subnets().subnet_ids
)
elb.CfnLoadBalancer(
self,
"elb-http-dict",
listeners=[
{
"instancePort":"10000",
"loadBalancerPort":"10000",
"protocol":"http" # Sensitive
}
],
subnets=vpc.select_subnets().subnet_ids
)
----
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancing/LoadBalancer.html[aws_cdk.aws_elasticloadbalancing.LoadBalancer]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/ApplicationLoadBalancer.html[aws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancer]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/ApplicationListener.html[ aws_cdk.aws_elasticloadbalancingv2.ApplicationListener]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/NetworkLoadBalancer.html[aws_cdk.aws_elasticloadbalancingv2.NetworkLoadBalancer]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancingv2/NetworkListener.html[aws_cdk.aws_elasticloadbalancingv2.NetworkListener]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancing/LoadBalancerListener.html[aws_cdk.aws_elasticloadbalancing.LoadBalancerListener]:
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancing/CfnLoadBalancer.html[aws_cdk.aws_elasticloadbalancing.CfnLoadBalancer]:
[source,python]
----
from aws_cdk import (
aws_elasticloadbalancing as elb,
)
elb.CfnLoadBalancer(
self,
"elb-ssl",
listeners=[
elb.CfnLoadBalancer.ListenersProperty(
instance_port="10043",
load_balancer_port="10043",
protocol="ssl",
ssl_certificate_id=CERTIFICATE_ARN
)
],
subnets=vpc.select_subnets().subnet_ids
)
elb.CfnLoadBalancer(
self,
"elb-https-dict",
listeners=[
{
"instancePort":"10443",
"loadBalancerPort":"10443",
"protocol":"https",
"sslCertificateId":CERTIFICATE_ARN
}
],
subnets=vpc.select_subnets().subnet_ids
)
----
For https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_elasticloadbalancing/LoadBalancer.html[aws_cdk.aws_elasticloadbalancing.LoadBalancer]:
* Using {protocol.insecure} protocol is insecure. Use {protocol.alternatives} instead.
* Make sure STARTTLS is used to upgrade to a secure connection using SSL/TLS.
For `aws_cdk.aws_elasticloadbalancing.LoadBalancer`, `aws_cdk.aws_elasticloadbalancing.CfnLoadBalancer`, `aws_cdk.aws_elasticloadbalancing.LoadBalancerListener`, `aws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancer`, `aws_cdk.aws_elasticloadbalancingv2.NetworkLoadBalancer`, `aws_cdk.aws_elasticloadbalancingv2.ApplicationListener`, `aws_cdk.aws_elasticloadbalancingv2.ApplicationListener`, `aws_cdk.aws_elasticloadbalancingv2.NetworkListener` and `aws_cdk.aws_elasticloadbalancingv2.CfnListener`:
* Make sure that using network protocols without an SSL/TLS underlay is safe here.
For `aws_cdk.aws_elasticache.CfnReplicationGroup`:
* Make sure that disabling transit encryption is safe here.
For `aws_cdk.aws_kinesis.CfnStream` and `aws_cdk.aws_kinesis.Stream`:
* Make sure that disabling stream encryption is safe here.
=== Highlighting
For `aws_cdk.aws_elasticloadbalancingv2.ApplicationLoadBalancer`:
* Highlight the `protocol` parameter of the `add_listener` call when it is set
to elbv2.ApplicationProtocol.HTTP
* Highlight the `add_listener` call when the `protocol` parameter is not set
and the port parameter is 80, 8000, 8080 or 8008
For `aws_cdk.aws_elasticloadbalancingv2.ApplicationListener`
* Highlight the `protocol` property of the object constructor when it is set to
elbv2.ApplicationProtocol.HTTP
* Highlight the object constructor call when the `protocol` parameter is not set
and the port parameter is 80, 8000, 8080 or 8008
For `aws_cdk.aws_elasticloadbalancingv2.NetworkLoadBalancer`
* Highlight the `protocol` parameter of the `add_listener` call when it is set
to elbv2.Protocol.TCP, elbv2.Protocol.UDP, or
elbv2.Protocol.TCP_UDP
* Highlight the `add_listener` call when the `protocol` parameter is not set
and the `certificates` parameter is not set or is an empty `Sequence`.
For `aws_cdk.aws_elasticloadbalancingv2.NetworkListener`
* Highlight the `protocol` property of the object constructor call when it is set
to elbv2.ApplicationProtocol.TCP, elbv2.ApplicationProtocol.UDP, or
elbv2.ApplicationProtocol.TCP_UDP
* Highlight the constructor call when the `protocol` parameter is not set
and the `certificates` parameter is not set or is an empty `Sequence`.
For `aws_cdk.aws_elasticloadbalancingv2.CfnListener`:
* Highlight the `protocol` property of the object constructor when set to
HTTP, TCP, UDP, or TCP_UDP.
For `aws_cdk.aws_elasticloadbalancing.LoadBalancer`:
* Highlight the `externalProtocol` dict entry in the `listeners` property of the
object constructor when set to `elb.LoadBalancingProtocol.TCP` or `elb.LoadBalancingProtocol.HTTP`.
* Highlight the `externalProtocol` parameter of the call to `add_listener` when set to `elb.LoadBalancingProtocol.TCP` or `elb.LoadBalancingProtocol.HTTP`.
For `aws_cdk.aws_elasticloadbalancing.CfnLoadBalancer`:
* When the `listeners` property of the object constructor is a `Sequence`
that contains a `dict` with a "protocol" entry set to "tcp" or "http",
highligth the "protocol" entry.
* When the `listeners` property of the object constructor is a `Sequence`
that contains an `elb.CfnLoadBalancer.ListenersProperty` with a `protocol`
property set to "tcp" or "http", highlight the protocol property.
For `aws_cdk.aws_elasticloadbalancing.LoadBalancerListener`:
* Highlight the `external_protocol` property of the object constructor when set to `elb.LoadBalancingProtocol.TCP` or `elb.LoadBalancingProtocol.HTTP`.
For `aws_cdk.aws_elasticache.CfnReplicationGroup`:
* Highlight the `transit_encryption_enabled` property of the object constructor if it is
present and set to False.
* Highlight the constructor call if the `transit_encryption_enabled` attribute is not set.
For `aws_cdk.aws_kinesis.CfnStream`:
* Highlight the object constructor when the `stream_encryption` property is not set.
* Highlight the `stream_encryption` property of the object constructor when set to None.
For `aws_cdk.aws_kinesis.Stream`:
* Highlight the `encryption` property of the object constructor when it is set to aws_kinesis.StreamEncryption.UNENCRYPTED