Using an existing load balancer with ApplicationLoadBalancedEc2Service #28805
Unanswered
vishal-scg
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using the below code to use an existing ALB but getting some errors .
`import aws_cdk as cdk
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_ecs_patterns as ecs_patterns
from aws_cdk import aws_autoscaling as autoscaling
from aws_cdk import aws_elasticloadbalancingv2 as elb
class EcsCdkStack(cdk.Stack):
Error
Traceback (most recent call last): File "/Users/vishal/Documents/hello-cdk/app.py", line 9, in <module> EcsCdkStack(app, "EcsCdkStack", File "/opt/homebrew/Caskroom/miniforge/base/envs/cdk/lib/python3.9/site-packages/jsii/_runtime.py", line 118, in __call__ inst = super(JSIIMeta, cast(JSIIMeta, cls)).__call__(*args, **kwargs) File "/Users/vishal/Documents/hello-cdk/hello_cdk/hello_cdk_stack.py", line 88, in __init__ service = ecs_patterns.ApplicationLoadBalancedEc2Service(self, "MyService", File "/opt/homebrew/Caskroom/miniforge/base/envs/cdk/lib/python3.9/site-packages/jsii/_runtime.py", line 118, in __call__ inst = super(JSIIMeta, cast(JSIIMeta, cls)).__call__(*args, **kwargs) File "/opt/homebrew/Caskroom/miniforge/base/envs/cdk/lib/python3.9/site-packages/aws_cdk/aws_ecs_patterns/__init__.py", line 7282, in __init__ jsii.create(self.__class__, self, [scope, id, props]) File "/opt/homebrew/Caskroom/miniforge/base/envs/cdk/lib/python3.9/site-packages/jsii/_kernel/__init__.py", line 334, in create response = self.provider.create( File "/opt/homebrew/Caskroom/miniforge/base/envs/cdk/lib/python3.9/site-packages/jsii/_kernel/providers/process.py", line 365, in create return self._process.send(request, CreateResponse) File "/opt/homebrew/Caskroom/miniforge/base/envs/cdk/lib/python3.9/site-packages/jsii/_kernel/providers/process.py", line 342, in send raise RuntimeError(resp.error) from JavaScriptError(resp.stack) RuntimeError: Can only call addTargets() when using a constructed Load Balancer or an imported Load Balancer with specified vpc; construct a new TargetGroup and use addTargetGroup
Beta Was this translation helpful? Give feedback.
All reactions