Skip to content

Instantly share code, notes, and snippets.

@lsauer
Last active September 7, 2017 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsauer/28c34370f89077ede252dc18494f0cd1 to your computer and use it in GitHub Desktop.
Save lsauer/28c34370f89077ede252dc18494f0cd1 to your computer and use it in GitHub Desktop.
Amazon AWS Cloudwatch report memory metric bash script
#!/bin/bash
memory=$(cat /proc/meminfo | grep MemFree: | awk '{print $2}')
memory=$(echo $memory/1000 | bc)
echo memory is: $memory
aws cloudwatch put-metric-data --metric-name Memory\
--namespace WebServer\
--unit Bytes \
--value $memory\
--dimensions InstanceID=i-093beb71f2d7647ce,InstanceType=m1.small\
--region eu-west-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment