Skip to content

Instantly share code, notes, and snippets.

@toshke
Created March 3, 2020 03:58
Show Gist options
  • Save toshke/9d109d8889551184e0f3c73f96a8afbe to your computer and use it in GitHub Desktop.
Save toshke/9d109d8889551184e0f3c73f96a8afbe to your computer and use it in GitHub Desktop.
batch put cloudwatch metrics
pushed = 0
namespace = 'my cw space'
while pushed < len(metric_data):
left = pushed
if len(metric_data) - pushed >= 20:
right = left + 20
else:
right = len(metric_data)
pushed += (right - left)
to_push = metric_data[left:right]
client.put_metric_data(Namespace=namespace, MetricData=to_push)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment