amazonlinux 2 yum install amazon-cloudwatch-agent 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