Important
-
The script is tested on the following architecture and only works on the following OS :
x86_64 (amd64): Amazon Linux 2, Amazon Linux 2023, SLES 12/15, RHEL 8/9, Ubuntu 20/22/24, Debian aarch64 (arm64): Amazon Linux 2, Amazon Linux 2023, SLES 12/15, RHEL 8/9, Ubuntu 20/22/24
Warning
- Please make sure that the EC2 instance(s) have necessary permission attached to it.
curl "https://raw.githubusercontent.com/sattyagrah/CloudWatchAgent/main/configuration.sh" -o "configuration.sh"
and
curl "https://raw.githubusercontent.com/sattyagrah/CloudWatchAgent/main/cwagentinstall.sh" -o "cwagentinstall.sh"
chmod u+x cwagentinstall.sh
./cwagentinstall.sh
Note
- If users want to change the configuration file of Cloudwatch agent or set the configuration file using wizards, they can do so by following the steps below :
-
Before executimg (after downloading) the cwagentinstall.sh file, make sure to comment the line 42 and 43.
-
Log in to your EC2 instance.
-
Run the command :
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
-
Follow the prompt and answer the questions asked and your configuration file will be ready.
-
After that you need to run the command (to start the CloudWatch agent) :
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
-
Bingo! You are all set now.