Skip to content

[ecs-patterns]: load balancer name of ApplicationLoadBalancerProps not working when creating ApplicationMultipleTargetGroupsEc2Service #23535

@thehope2k

Description

@thehope2k

Describe the bug

I'm creating an ecs service with multiple target groups using ecs_pattern module.

alb_props = ecs_patterns.ApplicationLoadBalancerProps(
            name="custom-alb-name",
            domain_name="*.example.com",
            domain_zone=route53.HostedZone.from_hosted_zone_attributes(
                self, "HostedZone",
                hosted_zone_id="xxxxxx",
                zone_name="example.com"
            ),
            listeners=[
                listener_1, listener2
            ],
            public_load_balancer=False
        )

ecs_service = ecs_patterns.ApplicationMultipleTargetGroupsEc2Service(
            self, "ECS-ID",
            service_name="service-name",
            cluster=cluster-name-ref,
            task_definition=task_definition,
            load_balancers=[alb_props],
            target_groups=[target_props_1, target_prop_2],
            cpu=1024,
            memory_reservation_mib=2048,
            desired_count=1
        )

Expected Behavior

The expected name of load balancer name should be "custom-alb-name"

Current Behavior

Load balancer name is auto-generated

Reproduction Steps

  1. Create cdk
  2. Wiring code like snip above
  3. Run cdk deploy

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.54.0

Framework Version

No response

Node.js Version

v16.15.0

OS

Window

Language

Python

Language Version

python 3.11.1

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecs-patternsRelated to ecs-patterns librarybugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions