Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdk/app.py Service Autoscaling NameError #18

Open
SSE69 opened this issue Jul 30, 2024 · 0 comments
Open

cdk/app.py Service Autoscaling NameError #18

SSE69 opened this issue Jul 30, 2024 · 0 comments

Comments

@SSE69
Copy link

SSE69 commented Jul 30, 2024

When uncommenting lines 94-104 in /ecsdemo-frontend/cdk/app.py to enable autoscaling :

# Enable Service Autoscaling
        self.autoscale = fargate_load_balanced_service.service.auto_scale_task_count(
           min_capacity=1,
           max_capacity=10
        )

cdk synth yields:

Traceback (most recent call last):
  File "xxx/ecsdemo-frontend/cdk/app.py", line 349, in <module>
    FrontendService(app, stack_name, env=_env)
  File "xxx/.venv/lib/python3.11/site-packages/jsii/_runtime.py", line 118, in __call__
    inst = super(JSIIMeta, cast(JSIIMeta, cls)).__call__(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "xxx/ecsdemo-frontend/cdk/app.py", line 94, in __init__
    self.autoscale = fargate_load_balanced_service.service.auto_scale_task_count(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'fargate_load_balanced_service' is not defined

Subprocess exited with error 1

Fix to self.fargate_load_balanced_service.service.auto_scale_task_count(...) line 94

# Enable Service Autoscaling
        self.autoscale = self.fargate_load_balanced_service.service.auto_scale_task_count(
           min_capacity=1,
           max_capacity=10
        )

Then all is well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant