Я работаю с Boto3 для создания моих таблиц в DynamoDB. Я включил автоматическое масштабирование, используя следующий код:
def conf_auto_scaling(self, table_name):
print("INFO :: Creating auto scaling for Table [%s]" % table_name)
# Read capacity
self.as_c.register_scalable_target(ServiceNamespace='dynamodb',
ResourceId='table/%s' % table_name,
ScalableDimension='dynamodb:table:ReadCapacityUnits',
MinCapacity=5,
MaxCapacity=4000)
# Write capacity
self.as_c.register_scalable_target(ServiceNamespace='dynamodb',
ResourceId='table/%s' % table_name,
ScalableDimension='dynamodb:table:WriteCapacityUnits',
MinCapacity=5,
MaxCapacity=1000)
percent_of_use_to_aim_for = 70.0
scale_out_cooldown_in_seconds = 60
scale_in_cooldown_in_seconds = 60
self.as_c.put_scaling_policy(ServiceNamespace='dynamodb',
ResourceId='table/%s' % table_name,
PolicyType='TargetTrackingScaling',
PolicyName='ScaleDynamoDBReadCapacityUtilization',
ScalableDimension='dynamodb:table:ReadCapacityUnits',
TargetTrackingScalingPolicyConfiguration={
'TargetValue': percent_of_use_to_aim_for,
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'DynamoDBReadCapacityUtilization'
},
'ScaleOutCooldown': scale_out_cooldown_in_seconds,
'ScaleInCooldown': scale_in_cooldown_in_seconds
})
self.as_c.put_scaling_policy(ServiceNamespace='dynamodb',
ResourceId='table/%s' % table_name,
PolicyType='TargetTrackingScaling',
PolicyName='ScaleDynamoDBWriteCapacityUtilization',
ScalableDimension='dynamodb:table:WriteCapacityUnits',
TargetTrackingScalingPolicyConfiguration={
'TargetValue': percent_of_use_to_aim_for,
'PredefinedMetricSpecification': {
'PredefinedMetricType': 'DynamoDBWriteCapacityUtilization'
},
'ScaleOutCooldown': scale_out_cooldown_in_seconds,
'ScaleInCooldown': scale_in_cooldown_in_seconds
})
Как включить параметр «Применить те же настройки к глобальным вторичным индексам»?