Remediation
Create a Secure Listener for an AWS Load Balancerβ
Prerequisitesβ
Before creating a secure listener, ensure you have the following resources configured in the same AWS Region as your load balancer:
- A Validated SSL/TLS Certificate: A certificate issued by AWS Certificate Manager (ACM) and in the ISSUED state.
- Backend Target: An existing target group (for ALB/NLB) or registered instances (for CLB) to forward traffic to.
- Certificate ARN: The Amazon Resource Name (ARN) of your certificate.
- For Application and Network Load Balancers, use the certificate's ACM ARN.
- For Classic Load Balancers, you can use the certificate's IAM Server Certificate ARN. You can find this in the IAM console or via the AWS CLI (
aws iam list-server-certificates).
Create a Secure Listenerβ
Use the appropriate command based on the load balancer type.
Application Load Balancerβ
aws elbv2 create-listener \
--load-balancer-arn {{load-balancer-arn}} \
--protocol HTTPS \
--port 443 \
--certificates CertificateArn={{certificate-arn}} \
--ssl-policy ELBSecurityPolicy-TLS13-1-3-2021-06 \
--default-actions Type=forward,TargetGroupArn={{existing-target-group-arn}}
The --ssl-policy parameter enforces a current, secure TLS configuration.
Network Load Balancerβ
aws elbv2 create-listener \
--load-balancer-arn {{load-balancer-arn}} \
--protocol TLS \
--port 443 \
--certificates CertificateArn={{certificate-arn}} \
--ssl-policy ELBSecurityPolicy-TLS13-1-3-2021-06 \
--default-actions Type=forward,TargetGroupArn={{existing-target-group-arn}}
Classic Load Balancerβ
Creating a secure listener for a Classic Load Balancer is a two-step process. First, create the listener, then create and attach a specific security policy.
-
Create the HTTPS Listener
Use the following command to create the listener with your certificate. Note that the
--listenersargument must be a single, quoted string.aws elb create-load-balancer-listeners \
--load-balancer-name {{load-balancer-name}} \
--listeners "Protocol=HTTPS,LoadBalancerPort=443,InstanceProtocol=HTTP,InstancePort=80,SSLCertificateId={{certificate-arn}}" -
Create and Attach the Security Policy
This step creates an SSL negotiation policy using the predefined
ELBSecurityPolicy-TLS-1-2-2017-01and applies it to the listener on port 443 to replaceELBSecurityPolicy-2016-08.# Create the policy referencing the predefined one
aws elb create-load-balancer-policy \
--load-balancer-name {{load-balancer-name}} \
--policy-name my-SSLNegotiation-policy \
--policy-type-name SSLNegotiationPolicyType \
--policy-attributes AttributeName=Reference-Security-Policy,AttributeValue=ELBSecurityPolicy-TLS-1-2-2017-01
# Attach the new policy to the listener on port 443
aws elb set-load-balancer-policies-of-listener \
--load-balancer-name {{load-balancer-name}} \
--load-balancer-port 443 \
--policy-names my-SSLNegotiation-policy