Skip to content

Commit f1facf1

Browse files
committed
x-elbvs docs: Small corrections and adding short example of lookup
1 parent 6e5e6d5 commit f1facf1

File tree

1 file changed

+80
-15
lines changed

1 file changed

+80
-15
lines changed

docs/syntax/compose_x/elbv2.rst

Lines changed: 80 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -282,26 +282,34 @@ Syntax
282282

283283
.. code-block:: yaml
284284
285-
name: <family name:container name>
286-
protocol: <str>
287-
port : <int>
288-
healthcheck: <str>
289-
TargetGroupAttributes: list|map
285+
<family_name:container_name:port>:
286+
protocol: <str>
287+
port : <int>
288+
healthcheck: <str>
289+
TargetGroupAttributes: list|map
290290
291291
`JSON Schema definition <https://github.com/compose-x/ecs_composex_specs/blob/main/ecs_composex_specs/x-elbv2.spec.json#L38>`__
292292

293-
name
294-
^^^^^^^^^^^^^^^^^^
293+
family_name:container_name:port
294+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
295+
296+
At minima, you must set ``family_name:container_name`` to indicate with container within the family is going to be used
297+
as the Target of the TargetGroup. Even if you only have 1 container in the family, must you set the container by name
298+
explicitly.
295299

296300
Given that you can now re-use one of the service in the docker-compose file multiple times for multiple ECS Services
297301
in multiple Task definitions, and ECS to ELBv2 supports to route traffic to a specific container in the task definition,
298302
you have to indicate the service name in the following format
299303

300-
.. code-block::
304+
If it so happens that you want to create multiple TargetGroups to the same container because it exposes different services
305+
on different ports, use the ``:port`` section to distinguish ports for the target group.
306+
307+
.. hint::
308+
309+
This value must match the value of `port`_. The `port`_ attribute will remain in future versions for compatibility, but
310+
might be moved to using ``:port`` instead.
311+
301312

302-
# name: <family_name>:<service_name>
303-
name: youtoo:app01
304-
name: app03:app03
305313

306314
.. hint::
307315

@@ -337,6 +345,10 @@ healthcheck
337345
- healthcheck: (port:protocol)(:healthy_count:unhealthy_count:intervals:timeout)?(:path:http_codes)?
338346
339347
348+
.. warning::
349+
350+
The string format is at risk to get deprecated in favor of the much simpler, more explicit properties mapping definition.
351+
340352
.. code-block:: yaml
341353
:caption: full definition with the properties
342354
@@ -373,7 +385,7 @@ In AWS CFN, it is a list of Key/Value objects, so compose-x supports it that way
373385
.. code-block:: yaml
374386
375387
Services:
376-
- name: app03:app03
388+
app03:app03:
377389
port: 5000
378390
healthcheck: 5000:TCP:7:2:15:5
379391
protocol: TCP
@@ -391,7 +403,7 @@ into a map/dict structure and compose-x will automatically convert it to the CFN
391403
.. code-block:: yaml
392404
393405
Services:
394-
- name: app03:app03
406+
name: app03:app03:
395407
port: 5000
396408
healthcheck: 5000:TCP:7:2:15:5
397409
protocol: TCP
@@ -457,6 +469,59 @@ into a map/dict structure and compose-x will automatically convert it to the CFN
457469
`Target Group Attributes`_
458470

459471

472+
Lookup
473+
=======
474+
475+
.. note::
476+
477+
Available since 1.0+
478+
479+
This allows to lookup existing LoadBalancers and either
480+
481+
* Create a new listener, and set services to use for it. Will fail if listener port is already in use on the LB.
482+
* Lookup LB + Listeners, to create a/multiple new listener rule(s) to an existing Listener (available only for ALB).
483+
484+
When using the ALB & Adding new rules to the existing Listener, you **MUST** define `Conditions` in the target list.
485+
This will allow the rules to be evaluated correctly.
486+
487+
.. hint::
488+
489+
It is recommended to always at least use the hostname condition.
490+
491+
Example
492+
---------
493+
494+
.. code-block:: yaml
495+
:caption: Lookup ALB and add rule to existing HTTPs listener.
496+
497+
x-elbv2:
498+
uploadstatusALB:
499+
DnsAliases:
500+
- Names:
501+
- my-target.hostname.tld
502+
Route53Zone: x-route53::PublicZone
503+
Lookup:
504+
Listeners:
505+
443:
506+
Tags:
507+
Name: my-https-listener
508+
Targets:
509+
- Conditions:
510+
- Field: host-header
511+
HostHeaderConfig:
512+
Values:
513+
- my-target.hostname.tld
514+
name: family:container:8080
515+
RoleArn: ${NONPROD_RO_ROLE_ARN}
516+
loadbalancer:
517+
Tags:
518+
Name: my-existing-lb
519+
Services:
520+
family:container:
521+
healthcheck: 8080:HTTP:7:2:15:5:/swagger-ui.html:401
522+
port: 8080
523+
protocol: HTTP
524+
460525
Settings
461526
============
462527

@@ -481,7 +546,7 @@ Examples
481546

482547

483548
.. code-block:: yaml
484-
:caption: ELBv2 with
549+
:caption: ELBv2 with Cognito OIDC
485550
486551
x-elbv2:
487552
authLb:
@@ -515,7 +580,7 @@ Examples
515580
prompt": "login"
516581
OnUnauthenticatedRequest: "deny"
517582
Services:
518-
- name: app03:app03
583+
name: app03:app03:
519584
port: 5000
520585
healthcheck: 5000:HTTP:7:2:15:5
521586
protocol: HTTP

0 commit comments

Comments
 (0)