Aug 22, 2024
Posted by
Lukas Bernert
Many of our customers are using Timescale for mission-critical applications. These services require close monitoring to ensure end-users don’t suffer service interruptions due to the lack of resources. Our previous post explained how you can monitor your Timescale service metrics with Datadog. Today, we’ll do the same with Amazon CloudWatch, which is especially interesting if you are already using this service to monitor other elements of your AWS infrastructure.
In this blog post, we walk you through integrating Timescale and CloudWatch to monitor your memory, CPU, and storage metrics. Timescale is the safest and most convenient way to run TimescaleDB databases in production, as it automates many of the most painful database management tasks—like backups, high availability, failover, scaling, upgrades, and much more. If you are not using Timescale yet, you can create an account here and use it entirely for free for 30 days.
We also cover the steps needed to integrate Timescale and CloudWatch in the video below:
To follow this tutorial, you must have an AWS account with the necessary permissions to create new users and policies.
You also need to have a Timescale service running. Exporting usage metrics data is a free feature on Timescale, and it is also available for trial users—you can start a free trial here.
Before jumping into the tutorial, let’s take a quick look at how this integration works in Timescale. This will help you make sense of the steps you’ll perform later:
The first step to set up this integration is getting the necessary credentials for CloudWatch, namely an access key and a secret key:
Now, let’s jump to the Timescale user interface.
As we saw earlier, you first need to create an exporter to configure your Datadog destination in Timescale. Exporters in Timescale are associated with a particular third-party tool (e.g., CloudWatch) and have an associated AWS region. If you want to monitor different services across multiple regions (for example, one service in eu-west-1 and another in us-east-1), you’ll need to create two exporters, one per region. If the regions match, you can attach multiple services to only one exporter.
To create a CloudWatch exporter in Timescale, follow these steps:
Your exporter is now live. The next step is connecting your service to the exporter, so telemetry data starts flowing into CloudWatch.
To do that, navigate to the Operations page of your service, and click on “Integrations.” Select the exporter you previously created in the drop-down menu, and click on “Attach exporter.”
Your service metrics are now accessible via Amazon CloudWatch! 🎉
To check that everything works, navigate to the Metrics page in CloudWatch and see if you can access your Timescale metrics. You should see a “Timescale” custom namespace in the Query menu. The metrics coming from your Timescale service start with timescale.cloud.*.
P.S. In CloudWatch, your Timescale services are identified by a service_id. You can see the service_id of a specific service by looking at the first part of the hostname. For example, your hostname may be mnyr5wrz9u.ye21f71f94.dev.metronome-cloud.com
—your service_id is mnyr5wrz9u
.
You can now integrate Timescale with Amazon CloudWatch to monitor your service metrics.
If you have a time-series application, Timescale is the most convenient way to run your database fleet. You’ll get the top performance of TimescaleDB for your time-series data—with automatic time partitioning, native compression, continuous aggregation, and SQL hyperfunctions for time-series analysis—plus all the advantages of PostgreSQL for your relational data. All this without the stress of manually managing backups, failover, or replication. You can try Timescale Cloud for free anytime; no credit card required.
But there’s more: you will soon be able to use Amazon CloudWatch to monitor performance metrics in Timescale. Stay tuned and happy monitoring!