You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/aws/services/elb.md
+30-31Lines changed: 30 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
---
2
2
title: "Elastic Load Balancing (ELB)"
3
-
linkTitle: "Elastic Load Balancing (ELB)"
4
3
description: Get started with Elastic Load Balancing (ELB) on LocalStack
5
4
tags: ["Base"]
6
5
---
@@ -12,7 +11,7 @@ It also monitors the health of its registered targets and ensures that it routes
12
11
You can check [the official AWS documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html) to understand the basic terms and concepts used in the ELB.
13
12
14
13
Localstack allows you to use the Elastic Load Balancing APIs in your local environment to create, edit, and view load balancers, target groups, listeners, and rules.
15
-
The supported APIs are available on our [API coverage page]({{< ref "coverage_elbv2" >}}), which provides information on the extent of ELB's integration with LocalStack.
14
+
The supported APIs are available on our [API coverage page](), which provides information on the extent of ELB's integration with LocalStack.
16
15
17
16
## Getting started
18
17
@@ -25,90 +24,90 @@ We will demonstrate how to create an Application Load Balancer, along with its t
25
24
26
25
Launch an HTTP server which will serve as the target for our load balancer.
27
26
28
-
{{< command >}}
29
-
$ docker run --rm -itd -p 5678:80 ealen/echo-server
30
-
{{< /command >}}
27
+
```bash
28
+
docker run --rm -itd -p 5678:80 ealen/echo-server
29
+
```
31
30
32
31
### Create a load balancer
33
32
34
33
To specify the subnet and VPC in which the load balancer will be created, you can use the [`DescribeSubnets`](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeSubnets.html) API to retrieve the subnet ID and VPC ID.
35
34
In this example, we will use the subnet and VPC in the `us-east-1f` availability zone.
To create a load balancer, you can use the [`CreateLoadBalancer`](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateLoadBalancer.html) API.
47
46
The following command creates an Application Load Balancer named `example-lb`:
To create a target group, you can use the [`CreateTargetGroup`](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html) API.
57
56
The following command creates a target group named `example-target-group`:
--protocol HTTP --target-type ip --port 80 --vpc-id $vpc_id \
62
61
| jq -r '.TargetGroups[].TargetGroupArn')
63
-
{{< /command >}}
62
+
```
64
63
65
64
### Register a target
66
65
67
66
To register a target, you can use the [`RegisterTargets`](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_RegisterTargets.html) API.
68
67
The following command registers the target with the target group created in the previous step:
Note that in some cases the `targets` parameter `Id` can be the `Gateway` address of the docker container.
77
76
You can find the gateway address by running `docker inspect <container_id>`.
78
-
{{< /callout >}}
77
+
:::
79
78
80
79
### Create a listener and a rule
81
80
82
81
We create a listener for the load balancer using the [`CreateListener`](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateListener.html) API.
83
82
The following command creates a listener for the load balancer created in the previous step:
To create a rule for the listener, you can use the [`CreateRule`](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateRule.html) API.
94
93
The following command creates a rule for the listener created above:
Finally, you can issue an HTTP request to the `DNSName` parameter of `CreateLoadBalancer` operation, and `Port` parameter of `CreateListener` command with the following command:
The following code snippets and sample applications provide practical examples of how to use ELB in LocalStack for various use cases:
177
176
178
-
-[Setting up Elastic Load Balancing (ELB) Application Load Balancers using LocalStack, deployed via the Serverless framework]({{< ref "/tutorials/elb-load-balancing" >}})
177
+
-[Setting up Elastic Load Balancing (ELB) Application Load Balancers using LocalStack, deployed via the Serverless framework]()
0 commit comments