Skip to content

Commit 050d404

Browse files
authored
Merge pull request #11771 from ndeloof/elb
Document custom load balancer usage
2 parents 3d49647 + cf81f3c commit 050d404

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

engine/context/ecs-integration.md

+38-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,44 @@ of a VPC when deploying a Compose application.
376376
- Use `x-aws-loadbalancer` as a top-level element in your Compose file to set
377377
the ARN of an existing LoadBalancer.
378378

379-
- Use `external: true` inside a network definition in your Compose file for
379+
The latter can be used for those who want to customize application exposure, typically to
380+
use an existing domain name for your application:
381+
382+
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:
383+
384+
```console
385+
$ aws ec2 describe-vpcs --filters Name=isDefault,Values=true --query 'Vpcs[0].VpcId'
386+
387+
"vpc-123456"
388+
$ aws ec2 describe-subnets --filters Name=vpc-id,Values=vpc-123456 --query 'Subnets[*].SubnetId'
389+
390+
[
391+
"subnet-1234abcd",
392+
"subnet-6789ef00",
393+
]
394+
```
395+
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.
396+
397+
```console
398+
$ aws elbv2 create-load-balancer --name myloadbalancer --type application --subnets "subnet-1234abcd" "subnet-6789ef00"
399+
400+
{
401+
"LoadBalancers": [
402+
{
403+
"IpAddressType": "ipv4",
404+
"VpcId": "vpc-123456",
405+
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-east-1:1234567890:loadbalancer/app/myloadbalancer/123abcd456",
406+
"DNSName": "myloadbalancer-123456.us-east-1.elb.amazonaws.com",
407+
...
408+
```
409+
1. To assign your application an existing domain name, you can configure your DNS with a
410+
CNAME entry pointing to just-created loadbalancer's `DNSName` reported as you created the loadbalancer.
411+
412+
1. Use Loadbalancer ARN to set `x-aws-loadbalancer` in your compose file, and deploy your application using `docker compose up` command.
413+
414+
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.
415+
416+
You also can use `external: true` inside a network definition in your Compose file for
380417
Docker Compose CLI to _not_ create a Security Group, and set `name` with the
381418
ID of an existing SecurityGroup you want to use for network connectivity between
382419
services:

0 commit comments

Comments
 (0)