Skip to content

Install CloudWatch agent (along with its configuration) in EC2 Linux instances.

Notifications You must be signed in to change notification settings

sattyagrah/AWSCloudwatchAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

How to use

Considerations

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
    

Prerequisites

Warning

  1. Please make sure that the EC2 instance(s) have necessary permission attached to it.

Download the script

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"

Give executable permission

chmod u+x cwagentinstall.sh

Execute the script

./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 :
  1. Before executimg (after downloading) the cwagentinstall.sh file, make sure to comment the line 42 and 43.

  2. Log in to your EC2 instance.

  3. Run the command :

    sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
  4. Follow the prompt and answer the questions asked and your configuration file will be ready.

  5. 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
  6. Bingo! You are all set now.

About

Install CloudWatch agent (along with its configuration) in EC2 Linux instances.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages