Skip to content

Instantly share code, notes, and snippets.

@Zer0Divis0r
Last active November 18, 2023 14:39
Show Gist options
  • Save Zer0Divis0r/3207c09c1197e015cc24162bd7f0eba1 to your computer and use it in GitHub Desktop.
Save Zer0Divis0r/3207c09c1197e015cc24162bd7f0eba1 to your computer and use it in GitHub Desktop.
Install CloudWatch agent on EC2 Ubuntu
# Attach IAM role to the instance with the following policies:
# AmazonSSMManagedInstanceCore
# CloudWatchAgentServerPolicy
wget https://amazoncloudwatch-agent-eu-central-1.s3.eu-central-1.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json
sudo service amazon-cloudwatch-agent restart
tail -f /opt/aws/amazon-cloudwatch-agent/logs/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment