Closed KvistA-ELS closed 2 years ago
For reference, this is how auto scaling is set up:
- name: Scaling_policy for reads in DynamoDB
community.aws.aws_application_scaling_policy:
region: eu-west-1
state: present
policy_name: DynamoDBScalingPolicyRead
service_namespace: dynamodb
resource_id: 'table/DynamoDB-fail-test'
scalable_dimension: dynamodb:table:ReadCapacityUnits
policy_type: TargetTrackingScaling
minimum_tasks: 1
maximum_tasks: 10
target_tracking_scaling_policy_configuration:
TargetValue: 80
PredefinedMetricSpecification:
PredefinedMetricType: DynamoDBReadCapacityUtilization
cc @jillr @loia @markuman @s-hertel @tremble click here for bot help
@KvistA-ELS
Thanks for taking the time to open this issue. If you don't pass the read_capacity
and write_capacity
parameters then Ansible shouldn't try setting them. Could you try that please?
Given that your autoscaling policy is managing the capacity is there a reason you need to pass read_capacity
and write_capacity
?
Hi @tremble They are set to 1 by default if not set, and that would very often be seen as a scale down :) https://github.com/ansible-collections/community.aws/blob/fe0811f9c070fdf6f69254a6e50510dfb7d6cf1a/plugins/modules/dynamodb_table.py#L570 /Anders
@KvistA-ELS That should only apply when creating a new table/index... If it's not, then the issue lies somewhere in that code path...
@tremble I have just done a test where the last table update doesn't have the values - looks like you are right. I started out with an earlier version of the module that would always set 1 for capacity.
@KvistA-ELS the code had a pretty substantial rewrite with community.aws 2.1.0 (migrating from boto SDK to boto3)
I'm going to close out this issue (and the PR), since not passing the capacity parameters fixes the issue.
Summary
When using dynamodb_table to create or update a DynamoDB table that is using auto scaling, it will often fail because AWS only allows 4 scale downs a day, after that, you can only do scale down once an hour.
The reason for this fail is that when describe-table is called, it returns the values of DynamoDB, which then will be set by auto scaling.
The most easy fix for this, would be to add an option to ignore *_capacity when auto scaling is handled afterwards.
Issue Type
Bug Report
Component Name
dynamodb_table
Ansible Version
Collection Versions
AWS SDK versions
Configuration
OS / Environment
Linux + Docker
Steps to Reproduce
By itself, this will of cause not fail because there haven't been done any scale up/downs, so to replicate this, this ansible will reduce read/write a 4 times and then the 5th time will fail. This will "mimic" the dynamic scaling that is done by auto scaling.
Expected Results
I expect being able to have dynamodb_table not try to set capacity when I don't want it to change anything, but it can't as it uses the dynamic capacity values to check if it needs to update.
Actual Results
Code of Conduct