Skip to content
This repository was archived by the owner on Jun 22, 2026. It is now read-only.
This repository was archived by the owner on Jun 22, 2026. It is now read-only.

Updating hosting from count: 1 to a load balanced configuration doesn't work with http.alb #5557

Closed

Description

@joelypolly

We have an existing ALB which is populated in the http.alb field. When used in conjunction with a load balanced hosting setup as specified below we get an error in deploying the service. Note: Deploying a single host works (count: 1), Target Group shows IP in the Target Type field for single host deployments.

deploy service service to environment beta: deploy service: check if changeset is empty: create change set copilot-ID for stack app-beta-service: ValidationError: Template error: instance of Fn::GetAtt references undefined resource TargetGroup
	status code: 400, request id: ID: describe change set copilot-dd029c74-a3e8-49fe-9802-4f1d06593d22 for stack app-beta-service: ValidationError: Stack [app-beta-service] does not exist
	status code: 400, request id: ID: describe stack: describe stack events for stack app-beta-service: ValidationError: Stack [app-beta-service] does not exist
	status code: 400, request id: ID

Load Balancing Config

    http:
      # Import the existing ownit-shared-lb
      alb: arn:aws:elasticloadbalancing:us-east-1:account:loadbalancer/app/shared-beta-lb/restofarn
    count: 
      range: 1-2
      cooldown:
        in: 60s
        out: 30s
      cpu_percentage: 70
      memory_percentage: 80
      response_time: 2s

Activity

  1. added
    guidanceIssue requesting guidance or information about usage
    on Dec 13, 2023
  2. iamhopaul123 commented on Dec 13, 2023

    @iamhopaul123
    Contributor

    Looks like it is related to this bug #5485. We are working on a patch release which shall fix this issue.

  3. removed
    guidanceIssue requesting guidance or information about usage
    on Dec 13, 2023
  4. iamhopaul123 commented on Dec 13, 2023

    @iamhopaul123
    Contributor

    Hello! The fix is now released in v1.32.1: https://github.com/aws/copilot-cli/releases/tag/v1.32.1

  5. joelypolly commented on Dec 14, 2023

    @joelypolly
    Author

    @iamhopaul123
    Using the v1.32.1 doesn't seem to resolve the issue.
    Same error as the original comment.

    copilot --version
    copilot version: v1.32.1
    

    I delete the stack complete and ran it with the following yaml

      beta:
        cpu: 512 # Number of CPU units for the task.
        memory: 1024 # Amount of memory in MiB used by the task.
        platform: linux/arm64 # See https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#platform
        count: # Number of tasks that should be running in your service. https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#count-range
          range: 1-2
          cooldown:
            in: 60s
            out: 30s
          cpu_percentage: 70
          memory_percentage: 80
          response_time: 2s
        exec: true # Enable running commands in your container.
        network:
        connect: true # Enable Service Connect for intra-environment traffic between services.
        variables:
          IS_AWS: true
          ASPNETCORE_ENVIRONMENT: Beta
        http:
          # Import the existing shared-lb
          alb: arn:aws:elasticloadbalancing:us-east-1:accountid:loadbalancer/app/shared-beta-lb/id
          path: "/"
          # Healthcheck endpoint from the SystemModule
          healthcheck:
            path: "/api/system/heartbeat"
            healthy_threshold: 2
            unhealthy_threshold: 2
            grace_period: 10s
            interval: 6s
            timeout: 5s
          deregistration_delay: 5s # Speeds up deploys
          redirect_to_https: true
          alias: "example.com"
          hosted_zone: "ZONEID"
    
  6. iamhopaul123 commented on Dec 14, 2023

    @iamhopaul123
    Contributor

    Hello @joelypolly. You are right. I am terribly sorry about that. It is because we didn't fix the part for target group referencing the ALB metric (response_time) when users import ALB. Would you mind using yaml patch for a temporary workaround?

    - op: replace
      path: /Resources/AutoScalingPolicyALBAverageResponseTime/Properties/TargetTrackingScalingPolicyConfiguration/CustomizedMetricSpecification/Dimensions/1/Value
      value: !GetAtt TargetGroupForImportedALB.TargetGroupFullName
  7. joelypolly commented on Dec 14, 2023

    @joelypolly
    Author

    That fixed the problem. Thanks @iamhopaul123

  8. d-flood commented on May 10, 2024

    @d-flood

    I'm experiencing a related problem. When trying to import an existing ALB into a Copilot service manifest that includes autoscaling, I get the following error:

    ✘ Proposing infrastructure changes for stack amendments-prod-amendments
    ✘ deploy service amendments to environment prod: deploy service: check if changeset is empty: create change set copilot-f99e579c-f5af-477e-b59c-fb58561aa26b for stack amendments-prod-amendments: ValidationError: Template error: instance of Fn::GetAtt references undefined resource TargetGroup
            status code: 400, request id: c2feacc3-42a0-464d-b45e-029c8b006127: describe change set copilot-f99e579c-f5af-477e-b59c-fb58561aa26b for stack amendments-prod-amendments: ChangeSetNotFound: ChangeSet [copilot-f99e579c-f5af-477e-b59c-fb58561aa26b] does not exist
    

    The relevant portion of the service manifest:

        count:
          cooldown:
            in: 30s
            out: 60s
          cpu_percentage: 70
          memory_percentage:
            value: 80
            cooldown:
              in: 60s
              out: 160s
          requests: 1000 # problem is here
          response_time: 3s
          range:
            min: 1
            max: 3

    When I remove requests, the service deploys deploys and uses the imported ALB.

  9. iamhopaul123 commented on May 10, 2024

    @iamhopaul123
    Contributor

    Hello @d-flood. Does the yaml patch workaround work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugIssues that are bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions