Monitoring Your Timescale Cloud Services With Amazon CloudWatch

Monitoring Your Timescale Cloud Services With Amazon CloudWatch

Many of our customers are using Timescale Cloud 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 Cloud 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 Cloud and CloudWatch to monitor your memory, CPU, and storage metrics. Timescale Cloud 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 Cloud 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 Cloud and CloudWatch in the video below:

Editor's Note: We’re also working on a Prometheus integration, which will be coming soon. Stay tuned!

Prerequisites

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 Cloud service running. Exporting usage metrics data is a free feature on Timescale Cloud, and it is also available for trial users—you can start a free trial here.

Timescale Cloud and Amazon CloudWatch: Under the Hood

Before jumping into the tutorial, let’s take a quick look at how this integration works in Timescale Cloud. This will help you make sense of the steps you’ll perform later:

  • Timescale Cloud has an internal metrics collector service that silently watches all your Timescale Cloud services created in a particular region (e.g., us-east-1).
  • If you want to expose the metrics for a specific service and send them to an observability tool like Amazon CloudWatch, you will first create an “exporter” in Timescale Cloud.
  • Once you have created an exporter (linked to a specific region and a specific observability tool), you will attach the exporter to the service you want to monitor. This under-the-hood exporter is OpenTelemetry—it will give your metrics the correct format.
  • Once your service is attached to the exporter, your service metrics will be sent automatically to CloudWatch.
Architecture diagram showcasing the basic integration elements between Timescale Cloud and Amazon CloudWatch
Architecture diagram showcasing the basic integration elements between Timescale Cloud and Amazon CloudWatch

Configuring Amazon CloudWatch

The first step to set up this integration is getting the necessary credentials for CloudWatch, namely an access key and a secret key:

  • Head to the “Identity and Access Management (IAM)” console in AWS.
  • Navigate to Users and click on “Add user.” On the first screen, give your user a descriptive name, and select “Access key - Programmatic access.”
The user interface with the steps to Add User
  • On the next screen, select “Attach existing policies directly.” Search for “CloudWatchFullAccess,” select the policy, and click Next.
The steps for attaching existing policies directly
  • On the following screen, you can add tags to help identify this user, but this is optional.
  • Once you create your user, write down the access and security keys.

Exporting Metrics From Timescale Cloud

Now, let’s jump to the Timescale Cloud user interface.

As we saw earlier, you first need to create an exporter to configure your Datadog destination in Timescale Cloud. Exporters in Timescale Cloud 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 Cloud, follow these steps:

  • Navigate to the Integrations page in the left menu.
The Integrations page in the left menu
  • On the Integrations page, click on “Add exporter.”
  • You’ll be taken to the configuration page for your exporter. Here, select the tool you want to integrate your service with—in this case, CloudWatch. Also, choose the Timescale Cloud region for this exporter (remember that this needs to be the same region as the service you want to export metrics from).
The Create an exporter menu
  • Next, configure your CloudWatch exporter. You’ll need to define a log group name, log stream name, and namespace (these are all CloudWatch mandatory parameters). To get started, you can keep the defaults. For the CloudWatch credentials, use the ones you retrieved earlier. And for the region, select the same as your Timescale Cloud service.
The menu for configuring the Cloud exporter
  • You can also define an IAM role (an identity you can create in your account with specific permissions) for uploading metrics. This step is optional, but having a dedicated role with only CloudWatch permissions is a recommended security practice.
  • Once you’re done, click on “create exporter.”

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.”

Attaching the exporter in the user interface

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 Cloud metrics. You should see a “Timescale Cloud” custom namespace in the Query menu. The metrics coming from your Timescale Cloud service start with timescale.cloud.*.

The CloudWatch metrics user interface

P.S. In CloudWatch, your Timescale Cloud 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.

Wrapping Up

You can now integrate Timescale Cloud with Amazon CloudWatch to monitor your service metrics.

If you have a time-series application, Timescale Cloud 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 Cloud. Stay tuned and happy monitoring!

The open-source relational database for time-series and analytics.
Try Timescale for free
This post was written by
5 min read
Cloud
Contributors

Related posts

TimescaleDB - Timeseries database for PostgreSQL

Explore TimescaleDB

Learn more about how TimescaleDB works, compare versions, and get technical guidance and tutorials.

Go to docs Go to products