Grafana Cloud: Manage the AWS Observability app as code with Terraform
Imagine setting up your AWS configuration in Grafana Cloud by hand and clicking through menus. When you only have a few services, it’s not a big deal. But as you add more and more, keeping track of every little change becomes a headache. It’s easy to make mistakes, and before you know it, things can get out of sync and your monitoring becomes unreliable.
Now picture using Terraform instead. You write down exactly how you want your AWS services to be set up in a simple, clear format—like writing a recipe. This “recipe” is saved and tracked, so you always know what’s been changed and when. If something goes wrong, you can easily go back to a previous version. Setting up new monitoring configuration becomes quick and automatic, ensuring everything is consistent every single time.
Using code to manage your AWS Observability application just makes things much smoother and more dependable as you grow, and in this blog we’ll show you how to do just that.
Manage AWS configuration in Grafana Cloud with Terraform
Using infrastructure as code is crucial for maintaining consistency, reproducibility, and efficiency in cloud environments. If you’re a Grafana Cloud user leveraging our AWS integration, you can benefit immensely from exporting your current configuration to Terraform. This allows you to manage your Grafana Cloud setup alongside your AWS infrastructure using a declarative approach.
Using Terraform for your AWS Observability app in Grafana Cloud offers several benefits. For example, you can:
- Track changes to your Grafana Cloud configuration with Git for version control.
- Automate deployments and updates to your Grafana Cloud-AWS integration.
- Ensure consistency of your Grafana Cloud setup across various environments and reduce config redundancy, aligning with DRY(Don’t Repeat Yourself).
- Facilitate team collaboration on infrastructure changes.
How to export AWS configuration in Grafana Cloud to Terraform
Follow these steps to get started:
- Access Grafana Cloud: Log in to your Grafana Cloud account. (If you don’t already have one, you can sign up for a forever-free account today.)
- Navigate to integrations: In your Grafana Cloud stack, expand “Cloud provider” in the main menu. Click AWS, then click on the Configuration tab. Click on the AWS accounts tile. Choose the account you want to export the Terraform configuration for.
- Export configuration: Click on Actions, then on Export as Terraform. A modal with the Terraform code should appear.
- Copy Terraform code: Click Copy to clipboard to copy all of the code and paste it in your file.
- Initialize Terraform: Run
terraform init
in the directory containing the downloaded files. - Plan changes: Execute
terraform plan
to review the proposed changes. - Apply changes: Apply the configuration with
terraform apply
.
There’s supposed to be a video here, but for some reason there isn’t. Either we entered the id wrong (oops!), or Vimeo is down. If it’s the latter, we’d expect they’ll be back up and running soon. In the meantime, check out our blog!
To get started, use this example snippet for your Terraform configuration:
resource "grafana_cloud_provider_aws_account" "example_account" {
stack_id = "your_stack_id"
role_arn = "your_arn"
regions = ["us-east-2"]
# ... other configuration details ...
}
From there, iterate to meet your needs. Using this approach enhances control, automation, and collaboration—ultimately leading to a more robust and efficient monitoring setup.
Grafana Cloud is the easiest way to get started with metrics, logs, traces, dashboards, and more. We have a generous forever-free tier and plans for every use case. Sign up for free now!