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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom cloudformation resource for scale up adustment #249

Merged
merged 12 commits into from
Jul 9, 2018

Conversation

brendanmcfarland
Copy link
Contributor

Goals here:

  • Allow maxSize to be parameterized in templates
  • scaleUp by approximately 10% of the max size (round to an integer)
    • Max scaling adjustment of 100
    • Min scaling adjustment of 1

Tested this out with maxSize as a cf.ref and updating maxSize to 3333, 33, 250, etc. Looked 馃啑 to me.

cc: @jakepruitt @arunasank @k-mahoney @rclark

Copy link

@jakepruitt jakepruitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried passing garbage strings into the maxSize option? If we allow a ref, the user could pass in anything

@brendanmcfarland
Copy link
Contributor Author

Yep, when passing in garbage the response is:

ERROR: Failed to create stack: ValidationError: Parameter 'maxSize' must be a number.

Or:

ERROR: Failed to generate changeset: ValidationError: Parameter 'maxSize' must be a number.

@jakepruitt
Copy link

Nice!

@arunasank
Copy link
Contributor

Awesome! 馃檶

@brendanmcfarland
Copy link
Contributor Author

Ah - I've realized that you could send a string parameter in if you changed the type of your cloudormation parameter from Number to something else. In this case the failure hits after the validation and during the deploy at:

WatchbotScalingTarget: Encountered non numeric value for property MaxCapacity

I'm against error handling in the custom resource; because if that lambda function errors the stack ends up in an hour long wait before ending in an UpdateRollbackFailed state.

I don't see that we've done any validation on other fields like CPU, minSize, etc. So it feels okay to me to leave this as the way a user encounters failure if they put in a non-numeric maxSize.

lib/template.js Outdated
Role: cf.getAtt(prefixed('ScalingRole'), 'Arn'),
Code: {
ZipFile: cf.sub(`
var response = require('cfn-response');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooooh good find.

lib/template.js Outdated
Role: cf.getAtt(prefixed('LambdaScalingRole'), 'Arn'),
Code: {
ZipFile: cf.sub(`
var response = require('cfn-response');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick var => const?

Copy link

@jakepruitt jakepruitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one nitpick, but other than that I think this looks great

@brendanmcfarland brendanmcfarland merged commit e4576aa into master Jul 9, 2018
@brendanmcfarland brendanmcfarland deleted the custom-math branch July 13, 2018 02:23
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

Successfully merging this pull request may close these issues.

None yet

4 participants