-
Notifications
You must be signed in to change notification settings - Fork 11
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
853: Service availability in AWS #854
853: Service availability in AWS #854
Conversation
@@ -19,15 +19,18 @@ | |||
"@types/source-map-support": "^0.5.10", | |||
"@typescript-eslint/eslint-plugin": "^6.21.0", | |||
"@typescript-eslint/parser": "^6.21.0", | |||
"aws-cdk": "^2.131.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what makes this a devdependency and not a standard dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the CLI for running commands, such as "cdk synth", so it's not part of any built artifacts or build process. It's like using jest to run tests, or typescript to compile the code.
In contrast, aws-cdk-lib is used in our scripts that are run to produce the CloudFormation templates, which are then deployed to AWS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obviously I don't understand half of it, but it reads well and seems sensible enough
@pmarsh-scottlogic Understood! It's more complex than I would've liked, but the idea is that we schedule a pair of events, one in morning and one in evening, and when they run, the scheduler turns them into an "action" to run a lambda function. That lambda function has one job to do: adjust the number of tasks/containers the service is running: to 1 in the morning, 0 in the evening. But we need to adjust the service definition itself, because simply auto-scaling the running service to zero will cause Fargate to check its task definition and see that it needs at least one container running, so it immediately brings one up again. This is Fargate's job - it manages container deployment for us, optimising according to current traffic and our defined limits. But our "desired count" is the baseline to which our number of containers will return under "normal" load, and that desired count cannot be zero, as that would make no sense. Hence why this is a touch more complex than I would've liked, and hence the need for a lambda function to adjust the service definition. |
Description
It came to my attention that the fargate service and associated infrastructure is costing us more than $3 a day. We can decrease that by around 70% if we bring the service down overnight, and not have the application up over weekends.
Currently there is no trivial way to achieve this using CDK, although there are some alpha constructs in development which we can use, together with a lambda function, to update the service to flip "desired task count" from zero to 1 in the morning and back to zero in the evening.
Resolves #853
Screenshots
Concerns
Checklist
Have you done the following?