Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save it-am/4696d99f964e540717f53d4b999ace57 to your computer and use it in GitHub Desktop.
Save it-am/4696d99f964e540717f53d4b999ace57 to your computer and use it in GitHub Desktop.
install-cloudwatchagent-centos-and-amazonlin-userdata
#!/bin/bash
mkdir tempcloudwatch
cd tempcloudwatch
yum install wget -y
yum install unzip -y
wget https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip
unzip AmazonCloudWatchAgent.zip
sudo ./install.sh
wget https://YOUR-PUBLIC-URL-HERE-WITH-CONFIG-FILE -O config.json
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:config.json -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment