-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[WIP] DynamoDB: autoscaling policy #919
[WIP] DynamoDB: autoscaling policy #919
Conversation
aws-sdk-go was updated to 1.8.44 on master already: #900 |
I am interested in this feature. I don't see any recent activity on this thread. Is this still being worked? If not I can give it a shot |
I have pushed where I am with it, not had a lot of time but will try finish it up this week |
It would be nice if this patch also supported autoscaling on GSIs. You may run into a blocker in #671, the lack of any way to have terraform ignore changes to a GSI's capacity. That brings up another point, the docs for aws_appautoscaling_policy should probably indicate how to have terraform ignore changes on the table capacity. Otherwise, assuming the table itself is captured in Terraform, every time you run an |
I don't think additional code changes are required to support autoscaling on GSI - just keep the scalabledimension as dynamodb:index:ReadCapacityUnits |
Any update on this PR? We're excited to implement. 😄 |
Looking forward to this...thanks for spinning it up! We've been running a non-native scaling function in AWS Lambda and are eager to migrate to the native scaling. |
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.
Hi @stephencoe
thanks for raising the PR.
I understand this is WIP, I left you some comments there. Other than what I mentioned I think we'll need to reshuffle the schema a little bit.
It's currently very flat with all StepScalingPolicyConfiguration
-related fields in the 1st level, which makes it very difficult to implement this new scaling policy without conflicts as they're mutually exclusive.
I think the best way forward would be to deprecate adjustment_type
, cooldown
, metric_aggregation_type
, step_adjustment
and min_adjustment_magnitude
in favour of a new TypeList
& MaxItems: 0
field called step_scaling_policy_configuration
under which we'd nest all those fields.
We can't entirely avoid dealing with long conditionals around those deprecated fields, but those will hopefully, eventually disappear.
Let me know what you think and/or whether you need help with anything.
I'm happy to make the mentioned changes if you don't have time to spend on this PR, or at the very least deal with the deprecation in a separate PR if you want me to.
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"dimensions": &schema.Schema{ | ||
Type: schema.TypeList, |
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.
I think this should be TypeMap
instead?
}, | ||
"target_value": &schema.Schema{ | ||
Type: schema.TypeFloat, | ||
Required: true, |
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.
I think we can't just introduce a required field - that would cause troubles to users with existing configs which don't use/need this field. In other words I don't believe it needs to be required.
ScaleInCooldown: aws.Int64(int64(d.Get("scale_in_cooldown").(int))), | ||
ScaleOutCooldown: aws.Int64(int64(d.Get("scale_out_cooldown").(int))), | ||
TargetValue: aws.Float64(d.Get("target_value").(float64)), | ||
} |
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.
As it's only possible to use a single scaling policy at a time would it make more sense to create target_tracking_scaling_policy_configuration
and nest all these fields under it, so that we can then pass this object to the API optionally? e.g.
if v, ok := d.GetOk("target_tracking_scaling_policy_configuration"); ok {
params.TargetTrackingScalingPolicyConfiguration = &applicationautoscaling.TargetTrackingScalingPolicyConfiguration{}
# ...
}
Hi @radeksimko, Thanks for the feedback. Its unlikely that I am going to have a chance to pick this up again in the short term and I am aware there are a lot of people waiting for this to be implemented. Feel free to make the changes you have suggested if it helps to progress this towards being complete |
@stephencoe Thanks for the quick response and honesty, I'll pick it up in upcoming days. 😉 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Reasoning for this change
Adding autoscaling support for DynamoDB
Related issue
API Reference: http://docs.aws.amazon.com/ApplicationAutoScaling/latest/APIReference/API_PutScalingPolicy.html
Example configuration