InfraStudio Agents Start free

Guides

Connect AWS CloudWatch

Let the agents read what your servers were doing, from AWS CloudWatch. They read CPU, memory, disk, the database and alarms, and can change nothing.

Last updated

After this guide, the agents see what your servers were doing when they look at your numbers and your errors. A review can then name a server cause, with the number and the time. For example: the database ran out of memory at 03:05, and the errors started one minute later.

Without it, the agents see your visitors and your errors, but not your servers. A full disk or a server out of memory then looks like many unrelated errors.

Who can do it:

  • A key for every product: a workspace admin or owner.
  • A key for one product: a workspace admin or owner, or a person who may change the product's own keys and tools.

See Roles.

What the agents read

AWS CloudWatch is the part of AWS that keeps the numbers of your servers. The agents read these:

In AWSWhat they read
EC2 serversCPU, CPU credits, failed status checks, disk burst balance
EC2 servers with the CloudWatch agentMemory, swap, how full each disk is, time spent waiting for the disk
RDS databasesCPU, free memory, free storage, connections, reads and writes a second, their wait time, queue depth
EBS volumesReads and writes a second, queue length, burst balance
Load balancersRequests a second, response time, 5xx answers
ECS servicesCPU and memory
ElastiCacheCPU, memory, evictions, connections
SQS queuesMessages waiting, the age of the oldest one
AlarmsWhich are in alarm now, and when each changed

Three places use them:

  • The Product analytics review compares the last week with the week before. It looks for a server near a limit, and checks a slow page or a drop in your numbers against the servers at the same hours.
  • Error triage reads the servers' numbers around the first errors, when an error looks like the servers' own: a timeout, a lost connection, out of memory.
  • In Chat, you can ask about them. For example: "How busy was the database last night?"

The connection is read-only, and the agents never see its key. The platform keeps none of these numbers. CloudWatch keeps them, and the agents read them again each time.

1. Make a read-only user in AWS

  1. In the AWS console, open IAM → Policies → Create policy. Choose JSON, and paste this:
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": [
      "cloudwatch:GetMetricData",
      "cloudwatch:ListMetrics",
      "cloudwatch:DescribeAlarms",
      "cloudwatch:DescribeAlarmHistory"
    ],
    "Resource": "*"
  }]
}
  1. Open IAM → Users → Create user. Give the user this policy and nothing else. The user needs no access to the AWS console.
  2. Open the user, then Security credentials → Create access key. AWS shows an access key ID and a secret access key. Copy both.

These four reads are all the agents use. See AWS's guide to access keys.

2. Connect it

  1. In the app, open Settings → Integrations. In the group Your numbers and errors, press Connect on the row AWS CloudWatch.
  2. Paste the key into AWS access, in this form:
{"region": "eu-central-1", "access_key_id": "AKIA...", "secret_access_key": "..."}
  1. Choose the place under Use it for, and press Save and test.

The region is the AWS region your servers run in, such as eu-central-1 for Frankfurt. One key reads one region.

Note

If the test says that the key may not read CloudWatch, the user has no policy yet. Give it the policy from step 1.

3. Install the CloudWatch agent on your EC2 servers

For an EC2 server, AWS reports CPU, network and disk activity by itself. It does not report memory, or how full a disk is. For those, install the CloudWatch agent on the server. See AWS's guide to installing the CloudWatch agent.

RDS, load balancers, ECS, ElastiCache and SQS need nothing: AWS reports their numbers by itself.

When the agent is missing, a review says so, and says that it could not see memory and disk space.

What AWS charges

AWS bills your account a small fee for each read of these numbers, and for the numbers the CloudWatch agent sends. See CloudWatch pricing.

What you see when it worked

  • The row AWS CloudWatch says Connected, and Working after its test.
  • In Chat, ask: "What were the servers doing in the last week?" The answer names your servers and their numbers.
  • The next report of the Product analytics review has a part about the servers.

More