Skip to content

Commit eb9738f

Browse files
Updated CLI example for ELBv2 (#9506)
Co-authored-by: Daniil Millwood <daniilm@amazon.com>
1 parent 2857dac commit eb9738f

1 file changed

Lines changed: 95 additions & 86 deletions

File tree

Lines changed: 95 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,95 @@
1-
**Example 1: To change the default action to a forward action**
2-
3-
The following ``modify-listener`` example changes the default action (to a **forward** action)for the specified listener. ::
4-
5-
aws elbv2 modify-listener \
6-
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
7-
--default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f
8-
9-
Output::
10-
11-
{
12-
"Listeners": [
13-
{
14-
"Protocol": "HTTP",
15-
"DefaultActions": [
16-
{
17-
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f",
18-
"Type": "forward"
19-
}
20-
],
21-
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
22-
"Port": 80,
23-
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
24-
}
25-
]
26-
}
27-
28-
**Example 2: To change the default action to a redirect action**
29-
30-
The following ``modify-listener`` example changes the default action to a **redirect** action for the specified listener. ::
31-
32-
aws elbv2 modify-listener \
33-
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
34-
--default-actions Type=redirect,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f
35-
36-
Output::
37-
38-
{
39-
"Listeners": [
40-
{
41-
"Protocol": "HTTP",
42-
"DefaultActions": [
43-
{
44-
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f",
45-
"Type": "redirect"
46-
}
47-
],
48-
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
49-
"Port": 80,
50-
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
51-
}
52-
]
53-
}
54-
55-
**Example 3: To change the server certificate**
56-
57-
This example changes the server certificate for the specified HTTPS listener. ::
58-
59-
aws elbv2 modify-listener \
60-
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65 \
61-
--certificates CertificateArn=arn:aws:iam::123456789012:server-certificate/my-new-server-cert
62-
63-
Output::
64-
65-
{
66-
"Listeners": [
67-
{
68-
"Protocol": "HTTPS",
69-
"DefaultActions": [
70-
{
71-
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
72-
"Type": "forward"
73-
}
74-
],
75-
"SslPolicy": "ELBSecurityPolicy-2015-05",
76-
"Certificates": [
77-
{
78-
"CertificateArn": "arn:aws:iam::123456789012:server-certificate/my-new-server-cert"
79-
}
80-
],
81-
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
82-
"Port": 443,
83-
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65"
84-
}
85-
]
86-
}
1+
**Example 1: To change the default action to a forward action**
2+
3+
The following ``modify-listener`` example changes the default action to a ``forward`` action for the specified listener. ::
4+
5+
aws elbv2 modify-listener \
6+
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
7+
--default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f
8+
9+
Output::
10+
11+
{
12+
"Listeners": [
13+
{
14+
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2",
15+
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
16+
"Protocol": "HTTP",
17+
"Port": 80,
18+
"DefaultActions": [
19+
{
20+
"Type": "forward",
21+
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f"
22+
}
23+
]
24+
}
25+
]
26+
}
27+
28+
**Example 2: To change the default action to a redirect action**
29+
30+
The following ``modify-listener`` example changes the default action to a ``redirect`` action for the specified listener. ::
31+
32+
aws elbv2 modify-listener \
33+
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
34+
--default-actions Type=redirect, RedirectConfig='{Protocol=HTTPS,StatusCode=HTTP_302}'
35+
36+
Output::
37+
38+
{
39+
"Listeners": [
40+
{
41+
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2",
42+
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
43+
"Protocol": "HTTP",
44+
"Port": 80,
45+
"DefaultActions": [
46+
{
47+
"Type": "redirect",
48+
"RedirectConfig": {
49+
"Protocol": "HTTPS",
50+
"Port": "#{port}",
51+
"Host": "#{host}",
52+
"Path": "/#{path}",
53+
"Query": "#{query}",
54+
"StatusCode": "HTTP_302",
55+
}
56+
}
57+
]
58+
}
59+
]
60+
}
61+
62+
**Example 3: To change the server certificate**
63+
64+
The following ``modify-listener`` example changes the server certificate for the specified HTTPS listener. ::
65+
66+
aws elbv2 modify-listener \
67+
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65 \
68+
--certificates CertificateArn=arn:aws:iam::123456789012:server-certificate/my-new-server-cert
69+
70+
Output::
71+
72+
{
73+
"Listeners": [
74+
{
75+
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65",
76+
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
77+
"Protocol": "HTTPS",
78+
"Port": 443,
79+
"DefaultActions": [
80+
{
81+
"Type": "forward",
82+
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
83+
}
84+
],
85+
"SslPolicy": "ELBSecurityPolicy-2015-05",
86+
"Certificates": [
87+
{
88+
"CertificateArn": "arn:aws:iam::123456789012:server-certificate/my-new-server-cert"
89+
}
90+
],
91+
}
92+
]
93+
}
94+
95+
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*.

0 commit comments

Comments
 (0)