in index.py [0:0]
def update_shards(desiredCapacity, resourceName):
# Update the shard count to the new Desired Capacity value
try:
response = client_kinesis.update_shard_count(
StreamName=resourceName,
TargetShardCount=int(desiredCapacity),
ScalingType='UNIFORM_SCALING'
)
print("Response: ", response)
scalingStatus = "InProgress"
#need also to update alarm threshold using the put_metric_alarm
update_alarm_out(desiredCapacity, resourceName)
update_alarm_in(desiredCapacity, resourceName)
# In case of error of updating the sharding, raise an exception. Possible cause, you cannot reshard more than twice a day
except Exception as e:
print (e)
failureReason = str(e)
scalingStatus = "Failed"
pass
return scalingStatus