-
Notifications
You must be signed in to change notification settings - Fork 220
/
Copy pathdisable_auto-scaling.py
35 lines (30 loc) · 1.22 KB
/
disable_auto-scaling.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import boto3
aas_client = boto3.client('application-autoscaling')
#iam_client = boto3.client('iam')
table_name = "Music" # Add the name of the DynamoDB table you want to add auto-scaling to between the double quotes.
# detach the Write scaling policy to the table.
response = aas_client.delete_scaling_policy(
PolicyName='{}ScalingPolicy'.format(table_name),
ServiceNamespace='dynamodb',
ResourceId='table/{}'.format(table_name),
ScalableDimension='dynamodb:table:WriteCapacityUnits'
)
# detach the Read scaling policy to the table.
response = aas_client.delete_scaling_policy(
PolicyName='{}ScalingPolicy'.format(table_name),
ServiceNamespace='dynamodb',
ResourceId='table/{}'.format(table_name),
ScalableDimension='dynamodb:table:ReadCapacityUnits'
)
# Deregister the RCU targets for the table
response = aas_client.deregister_scalable_target(
ServiceNamespace='dynamodb',
ResourceId='table/{}'.format(table_name),
ScalableDimension='dynamodb:table:ReadCapacityUnits',
)
# Deregister the WCU targets for the table
response = aas_client.deregister_scalable_target(
ServiceNamespace='dynamodb',
ResourceId='table/{}'.format(table_name),
ScalableDimension='dynamodb:table:WriteCapacityUnits',
)