DynamoAutoscaler
Auto-generated documentation for dynamo_query.dynamo_autoscaler module.
Helper that handles registration and deregistration of auto scaling for DynamoDB tables and indexes.
- dynamo-query / Modules / Dynamo Query / DynamoAutoscaler
DynamoAutoscaler
class DynamoAutoscaler():
def __init__(
client: ApplicationAutoScalingClient,
logger: Optional[logging.Logger] = None,
) -> None:
Helper that handles registration and deregistration of auto scaling for DynamoDB tables and indexes.
Arguments
client
- Boto3 ApplicationAutoscaling client,logger
-logging.Logger
instance.
See also
DynamoAutoscaler.create_scaling_policy_configs
@staticmethod
def create_scaling_policy_configs(
metric_type: MetricTypeTypeDef,
target_value: float = SCALE_TARGET_VALUE,
scale_out_cooldown: int = SCALE_OUT_COOLDOWN,
scale_in_cooldown: int = SCALE_IN_COOLDOWN,
) -> TargetTrackingScalingPolicyConfigurationTypeDef:
Create auto scaling policy dict.
Arguments
metric_type
- DynamoDB Metric typetarget_value
- Percent of use to aim forscale_out_cooldown
- Scale out cooldown in secondsscale_in_cooldown
- Scale in cooldown in seconds
Returns
Scaling policy configs to use in put_scaling_policy
See also
DynamoAutoscaler().deregister_auto_scaling
def deregister_auto_scaling(
table_name: str,
global_secondary_indexes: Iterable[DynamoTableIndex] = (),
) -> None:
Deregister auto scaling for table.
Arguments
table_name
- Name of the tableglobal_secondary_indexes
- Indexes that should have autoscaling disabled
DynamoAutoscaler().deregister_scalable_target
def deregister_scalable_target(
table_name: str,
scalable_dimension: ScalableDimensionTypeDef,
index_name: Optional[str] = None,
) -> None:
Deregister scalable table or index.
Arguments
table_name
- the name of the tablescalable_dimension
- scalable dimension nameindex_name
- the name of the index. If provided - deregiters policy for index
See also
DynamoAutoscaler().put_scaling_policy
def put_scaling_policy(
table_name: str,
scalable_dimension: ScalableDimensionTypeDef,
scaling_policy_configs: TargetTrackingScalingPolicyConfigurationTypeDef,
index_name: Optional[str] = None,
) -> None:
Add scaling policy for table or for index.
Arguments
table_name
- Name of the tablescalable_dimension
- Scalable dimension namescaling_policy_configs
- Scaling policy configs from AWS docsindex_name
- Name of the index. If provided - adds policy for index
See also
DynamoAutoscaler().register_auto_scaling
def register_auto_scaling(
table_name: str,
global_secondary_indexes: Iterable[DynamoTableIndex] = (),
min_capacity: int = SCALE_MIN_CAPACITY,
max_capacity: int = SCALE_MAX_CAPACITY,
) -> None:
Register auto scaling for table.
Arguments
table_name
- Name of the tableglobal_secondary_indexes
- Indexes that should also have autoscalingmin_capacity
- MinCapacity for table and indexesmax_capacity
- MaxCapacity for table and indexes
DynamoAutoscaler().register_scalable_target
def register_scalable_target(
table_name: str,
scalable_dimension: ScalableDimensionTypeDef,
index_name: Optional[str] = None,
min_capacity: int = SCALE_MIN_CAPACITY,
max_capacity: int = SCALE_MAX_CAPACITY,
) -> None:
Register scalable table or index.
Arguments
table_name
- Name of the tablescalable_dimension
- Scalable dimension nameindex_name
- Name of the index. If provided - adds policy for indexmin_capacity
- MinCapacitymax_capacity
- MaxCapacity