Nerdy Drunk

Drunk on technology

User Tools

Site Tools


aws:cloudwatch

Table of Contents

AWS CloudWatch

Current

Amazon has made it much easier to use the Amazon CloudWatch Agent by making it open source (https://github.com/aws/amazon-cloudwatch-agent/), available via package managers, and including a configuration wizard. Here are my notes on my initial testing.

Example command to start the CloudWatch Agent

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

Amazon also has CloudFormation templates that will pre-install and configure the Amazon CloudWatch Agent.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent-New-Instances-CloudFormation.html

Previous

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:GetMetricStatistics"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:ListMetrics"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeTags"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
*/5 * * * * /root/aws-scripts-mon/mon-put-instance-data.pl --mem-util --mem-used --mem-avail

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html

aws/cloudwatch.txt · Last modified: 2022/07/21 10:41 by 127.0.0.1