install amazon cloudwatch on ec2 instance code example
Example: aws instance agent installation on command line (cloudwatchlogs)
sudo yum install -y awslogs
sudo systemctl start awslogsd
sudo systemctl enable awslogsd.service
sudo yum install -y awslogs
sudo systemctl start awslogsd
sudo systemctl enable awslogsd.service