copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Use existing ALB for Load Balanced Web Services

Open chris-adam-b12 opened this issue 3 years ago • 7 comments

Hello,

I'd like to deploy a Load Balanced Web Service using an existing ALB (that is already used for other ECS clusters). Is it possible ?

My application is deployed by a Jenkins pipeline using copilot and I don't want to delete the load balancer and reconfigured the old one every time.

Thank you

Related issues: #1457,

chris-adam-b12 avatar Mar 02 '22 09:03 chris-adam-b12

Hi @chris-adam-b12 !

Thank you for the feature request, it seems to be related to: https://github.com/aws/copilot-cli/issues/1457

To help us deliver the right thing, would the imported load balancer already have a port 80 or port 443 listener?
If there is already a port 443 listener I assume that you have your own managed certificates attached to it, is that correct?

efekarakus avatar Mar 02 '22 16:03 efekarakus

Hi @efekarakus ,

Indeed, it is related.

Yes, my load balancer have both port 80 and 443 listeners. I also have a certificate attached.

chris-adam-b12 avatar Mar 02 '22 19:03 chris-adam-b12

We'd like to have this feature too.

The ALB could be imported when the environment is created (like VPC and subnets), and certificates handling should be disabled.

rverpillot avatar Mar 16 '22 17:03 rverpillot

Same request. this feature would be really helpful. Since a single ALB can now be used to configure different services, I think it would also be important to have the different conditions for ALB routing rules, available as properties in the manifest. e.g host headers, HTTP headers, Query string, etc.

harrykiphork avatar Mar 22 '22 07:03 harrykiphork

Agreed, this would be really helpful. ALBs are the most expensive part of Copilot's load balanced web services for me - with spot tasks the compute costs can be low, but if I have a bunch of small apps that all need dev/qa/prod environments, then I'm going to spend a LOT on ALBs. Like maybe 50-75% of the total costs. It's nice that related services can reuse the same ALB but that is not a preferred way to go about organizing apps which should actually be entirely separate.

ColeDCrawford avatar Apr 01 '22 15:04 ColeDCrawford

+1. must have

mannharleen avatar May 17 '22 04:05 mannharleen

I am looking for a quick and easy way to build many Feature Environments. Copilot seems to solve that, but I am disappointed that it will be costly if I cannot use my existing ALB...

yyoda avatar Aug 15 '22 07:08 yyoda

+1 This feature would help in increasing cost efficiency for lower envs.

mascot6699 avatar Jul 27 '23 12:07 mascot6699

+1 Please add this feature.

forij avatar Aug 08 '23 12:08 forij

Hi all, AWS Copilot v1.32.0 is now released: https://github.com/aws/copilot-cli/releases/tag/v1.32.0 🎉🚀 We shipped the feature that lets you place your existing ALB in front of your Load-Balanced Web Service - just specify the name or the ARN of the ALB in the http.alb field. Check out our blog post for more details, as well as other very cool features ❤️ !

Lou1415926 avatar Nov 09 '23 21:11 Lou1415926

Closing the issue because the importing feature is already released in v1.32.0. Feel free to reopen it though, if you have questions / requests unanswered ❤️

Lou1415926 avatar Nov 10 '23 21:11 Lou1415926

Hi team! I have the following manifest.yml to designate an existing public-facing ALB for a specific Load-Balanced Web Service.

# Your service name will be used in naming your resources
name: prov-recos-copilot-service
type: Load Balanced Web Service

# Distribute traffic to your service.
http:
  # Requests to this path will be forwarded to your service.
  path: '/'
  # Parameters for existing AWS LoadBalancer resources that your service requires.
  alb: '<load balacer arn>'

# Configuration for your containers and service.
image:
  # Docker build arguments.
  build: Dockerfile
  # Port exposed through your container to route traffic to it.
  port: 8080

cpu: 4096       # Number of CPU units for the task.
memory: 8192    # Amount of memory in MiB used by the task.
platform: linux/x86_64
count: 1       # Number of tasks that should be running in your service.
exec: true     # Enable running commands in your container.
network:
  connect: true # Enable Service Connect for intra-environment traffic between services.

But I'm getting back the following error when I copilot deploy: execute deployment 1 of 1 in group 1: deploy service prov-recos-copilot-service to environment demo: validate imported ALB configuration for "http": imported ALB <load balacer arn> must have either one or two listeners

So I guess my question is, how do I add these parameters to my .yaml? Please

DaniAmaya avatar Nov 14 '23 14:11 DaniAmaya

Edit: moved my answer to #5473 !

Lou1415926 avatar Nov 14 '23 18:11 Lou1415926