AWS code-library medium security documentation change
Summary
Updated CLI examples for modifying Elastic Load Balancing listeners with corrected syntax, added ARN fields, restructured output examples, and explicit redirect configuration parameters.
Security assessment
The change introduces explicit HTTPS protocol specification in redirect configurations (Protocol=HTTPS) and proper status code usage (HTTP_302), which helps prevent insecure redirects. Correct certificate ARN usage in HTTPS listener examples ensures proper TLS configuration. These changes address potential misconfiguration risks that could lead to man-in-the-middle attacks or insecure traffic handling.
Diff
diff --git a/code-library/latest/ug/elastic-load-balancing-v2_example_elastic-load-balancing-v2_ModifyListener_section.md b/code-library/latest/ug/elastic-load-balancing-v2_example_elastic-load-balancing-v2_ModifyListener_section.md index e3a64cc29..09fd0e78d 100644 --- a//code-library/latest/ug/elastic-load-balancing-v2_example_elastic-load-balancing-v2_ModifyListener_section.md +++ b//code-library/latest/ug/elastic-load-balancing-v2_example_elastic-load-balancing-v2_ModifyListener_section.md @@ -19 +19 @@ CLI -The following `modify-listener` example changes the default action (to a **forward** action)for the specified listener. +The following `modify-listener` example changes the default action to a `forward` action for the specified listener. @@ -32,0 +33,2 @@ Output: + "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", + "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", @@ -33,0 +36 @@ Output: + "Port": 80, @@ -36,2 +39,2 @@ Output: - "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f", - "Type": "forward" + "Type": "forward", + "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f" @@ -39,4 +42 @@ Output: - ], - "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", - "Port": 80, - "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2" + ] @@ -49 +49 @@ Output: -The following `modify-listener` example changes the default action to a **redirect** action for the specified listener. +The following `modify-listener` example changes the default action to a `redirect` action for the specified listener. @@ -54 +54 @@ The following `modify-listener` example changes the default action to a **redire - --default-actions Type=redirect,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f + --default-actions Type=redirect, RedirectConfig='{Protocol=HTTPS,StatusCode=HTTP_302}' @@ -62,0 +63,2 @@ Output: + "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2", + "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", @@ -63,0 +66 @@ Output: + "Port": 80, @@ -66,2 +69,8 @@ Output: - "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f", - "Type": "redirect" + "Type": "redirect", + "RedirectConfig": { + "Protocol": "HTTPS", + "Port": "#{port}", + "Host": "#{host}", + "Path": "/#{path}", + "Query": "#{query}", + "StatusCode": "HTTP_302", @@ -69,4 +78,2 @@ Output: - ], - "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", - "Port": 80, - "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2" + } + ] @@ -79 +86 @@ Output: -This example changes the server certificate for the specified HTTPS listener. +The following `modify-listener` example changes the server certificate for the specified HTTPS listener. @@ -92,0 +100,2 @@ Output: + "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65", + "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", @@ -93,0 +103 @@ Output: + "Port": 443, @@ -96,2 +106,2 @@ Output: - "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067", - "Type": "forward" + "Type": "forward", + "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" @@ -106,3 +115,0 @@ Output: - "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188", - "Port": 443, - "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65" @@ -112,0 +120,2 @@ Output: +For more information, see [Listener rules](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules) in the _Application Load Balancers User Guide_. +