mirror of https://github.com/docker/docs.git
Merge pull request #11771 from ndeloof/elb
Document custom load balancer usage
This commit is contained in:
commit
050d40438c
|
@ -376,7 +376,44 @@ of a VPC when deploying a Compose application.
|
|||
- Use `x-aws-loadbalancer` as a top-level element in your Compose file to set
|
||||
the ARN of an existing LoadBalancer.
|
||||
|
||||
- Use `external: true` inside a network definition in your Compose file for
|
||||
The latter can be used for those who want to customize application exposure, typically to
|
||||
use an existing domain name for your application:
|
||||
|
||||
1. Use the AWS web console or CLI to get your VPC and Subnets IDs. You can retrieve the default VPC ID and attached subnets using this AWS CLI commands:
|
||||
|
||||
```console
|
||||
$ aws ec2 describe-vpcs --filters Name=isDefault,Values=true --query 'Vpcs[0].VpcId'
|
||||
|
||||
"vpc-123456"
|
||||
$ aws ec2 describe-subnets --filters Name=vpc-id,Values=vpc-123456 --query 'Subnets[*].SubnetId'
|
||||
|
||||
[
|
||||
"subnet-1234abcd",
|
||||
"subnet-6789ef00",
|
||||
]
|
||||
```
|
||||
1. Use the AWS CLI to create your load balancer. The AWS Web Console can also be used but will require adding at least one listener, which we don't need here.
|
||||
|
||||
```console
|
||||
$ aws elbv2 create-load-balancer --name myloadbalancer --type application --subnets "subnet-1234abcd" "subnet-6789ef00"
|
||||
|
||||
{
|
||||
"LoadBalancers": [
|
||||
{
|
||||
"IpAddressType": "ipv4",
|
||||
"VpcId": "vpc-123456",
|
||||
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-east-1:1234567890:loadbalancer/app/myloadbalancer/123abcd456",
|
||||
"DNSName": "myloadbalancer-123456.us-east-1.elb.amazonaws.com",
|
||||
...
|
||||
```
|
||||
1. To assign your application an existing domain name, you can configure your DNS with a
|
||||
CNAME entry pointing to just-created loadbalancer's `DNSName` reported as you created the loadbalancer.
|
||||
|
||||
1. Use Loadbalancer ARN to set `x-aws-loadbalancer` in your compose file, and deploy your application using `docker compose up` command.
|
||||
|
||||
Please note Docker ECS integration won't be aware of this domain name, so `docker compose ps` command will report URLs with loadbalancer DNSName, not your own domain.
|
||||
|
||||
You also can use `external: true` inside a network definition in your Compose file for
|
||||
Docker Compose CLI to _not_ create a Security Group, and set `name` with the
|
||||
ID of an existing SecurityGroup you want to use for network connectivity between
|
||||
services:
|
||||
|
|
Loading…
Reference in New Issue