{"id":17193,"date":"2025-06-11T09:54:25","date_gmt":"2025-06-11T16:54:25","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=17193"},"modified":"2025-06-23T22:49:01","modified_gmt":"2025-06-24T05:49:01","slug":"automate-capella-cluster-onoff-terraform","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/","title":{"rendered":"Optimizing TCO: Automate Cluster Hibernation Using Terraform"},"content":{"rendered":"<p>Couchbase Capella\u2019s Cluster On\/Off feature allows users to pause and resume their clusters seamlessly, without permanently deleting the data, helping optimise cloud expenses and improve operational efficiency.<\/p>\n<p>In this blog, we\u2019ll explore how this feature works and how you can automate it using Terraform.<\/p>\n<p>Users have two options for managing cluster availability:<\/p>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>On-Demand On\/Off \u2013 Manually pause and resume clusters as needed.<\/li>\n<li>Scheduled On\/Off \u2013 Automate pausing\/resuming clusters at specific dates and time zones.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Turning off (pausing) a cluster<\/h3>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Stops all cluster services.<\/li>\n<li>Persists data, configuration, and metadata.<\/li>\n<li>Frees compute resources to reduce costs while keeping storage intact.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Turning on (resuming) a cluster<\/h3>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Restores the cluster from a paused state.<\/li>\n<li>Restarts services and makes data accessible again.<\/li>\n<li>Allows clients to reconnect and resume operations seamlessly.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>Why use the cluster on\/off feature?<\/h2>\n<ol>\n<li>Saves computational costs and optimises based on usage:\n<ul>\n<li>When a cluster is turned off, compute resources (e.g., CPU, RAM) are not billed, reducing infrastructure costs significantly.<\/li>\n<li>When a cluster is OFF, you only pay the OFF amount (mostly storage and management costs).<\/li>\n<li>Helps align costs with actual usage instead of paying for idle resources.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ol start=\"2\">\n<li>Reduces operational overhead:\n<ul>\n<li>Eliminates the need for manual cluster provisioning and teardown.<\/li>\n<li>Users can easily resume a paused cluster without reconfiguring or redeploying resources.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<ol start=\"3\">\n<li>Persistence of data and cost-efficient development\/testing:\n<ul>\n<li>Data, schema (buckets, scopes, collections), indexes, users,\u00a0 allow lists, and backups remain intact when a cluster is paused.<\/li>\n<li>Ensures no loss of configuration when resuming operations.<\/li>\n<li>Developers can pause non-production environments outside of working hours. This prevents unnecessary costs in CI\/CD pipelines, staging, or UAT environments.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>Cost optimization<\/h2>\n<p>One of the simplest and most effective ways to reduce operational costs is by turning off clusters when they are not in use. We will consider the use case of an AWS cluster with<b> 3 nodes (Data, Index and Query) <\/b>using a <b>Developer Pro Plan<\/b> in Couchbase Capella<b>, <\/b>with the configuration of <b>2 vCPUs, 16 GB RAM, disk size <\/b>of<b> 50GB, disk type GP3, <\/b>and<b> IOPS 3000<\/b>.<\/p>\n<p>When this cluster is kept online 24\/7, it incurs a monthly compute cost of <b>$1,497.60<\/b> under the pay-as-you-go model. However, many development clusters are only needed during working hours. By simply shutting down the cluster for 12 hours each day, such as overnight, teams can save <b>$705.60 <\/b>per month, amounting to a <b>47% <\/b>reduction in compute costs. This makes a strong case for automating cluster downtime to optimise cloud spending without impacting developer productivity.<\/p>\n<p>In environments with multiple clusters or development environments that do not require round-the-clock availability, by scheduling downtime for non-essential clusters, teams can reallocate their budgets more effectively, investing in areas that directly impact business outcomes.<\/p>\n<hr \/>\n<h2>Getting started: deploy an on\/off schedule using the Terraform provider<\/h2>\n<p>The Capella Terraform Provider allows users to manage Capella deployments programmatically, automating resource orchestration. Let\u2019s go through a simple tutorial to deploy an On\/Off schedule in Capella through the Terraform Provider.<\/p>\n<p>To learn more about how to turn off or turn on the cluster <b>on demand <\/b>using Terraform<b>, <\/b>please refer to the examples and README provided in <a href=\"https:\/\/github.com\/couchbasecloud\/terraform-provider-couchbase-capella\/tree\/main\/examples\/cluster_onoff_ondemand\" target=\"_blank\" rel=\"noopener\">this<\/a> repository. There is a step-by-step overview of how to switch the cluster on\/off on demand.<\/p>\n<p>In addition to the cluster on\/off feature, an App Service can also be turned on\/off on demand. Please refer to the following <a href=\"https:\/\/docs.couchbase.com\/cloud\/management-api-reference\/index.html#tag\/App-Services\/operation\/appServiceOn\" target=\"_blank\" rel=\"noopener\">documentation<\/a> and the Terraform provider <a href=\"https:\/\/github.com\/couchbasecloud\/terraform-provider-couchbase-capella\/tree\/main\/examples\/app_service_onoff_ondemand\" target=\"_blank\" rel=\"noopener\">examples<\/a> for more information.<\/p>\n<h3>What you\u2019ll learn<\/h3>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li>The steps to configure the files and understand the commands required to run the Terraform scripts.<\/li>\n<li>A step-by-step tutorial on deploying a Cluster On\/Off schedule in Capella using the provider.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<hr \/>\n<h3>Prerequisites<\/h3>\n<p>Before you begin, ensure you have:<\/p>\n<ol>\n<li style=\"list-style-type: none\">\n<ol>\n<li>Terraform version &gt;= 1.5.2<\/li>\n<li>Go version &gt;= 1.2.0<\/li>\n<li>Capella paid account<\/li>\n<li>Capella cluster &#8211; You can either create a Couchbase cluster using the provider, the\u00a0 <a href=\"https:\/\/docs.couchbase.com\/cloud\/management-api-guide\/management-api-start.html#display-management-api-keys\" target=\"_blank\" rel=\"noopener\">Capella UI<\/a>, or the <a href=\"https:\/\/docs.couchbase.com\/cloud\/management-api-reference\/index.html?_gl=1*1p9slku*_gcl_au*NzQ3NTcyODMzLjE3NDQwNjkyMDk.#tag\/Clusters\/operation\/postCluster\" target=\"_blank\" rel=\"noopener\">Capella Management API<\/a> and use the corresponding <i>organization_id, project_id, and cluster_id<\/i> to create the on\/off schedule.<\/li>\n<li>Authentication APIKey &#8211; You can create the API key using the <a href=\"https:\/\/docs.couchbase.com\/cloud\/management-api-guide\/management-api-start.html?_gl=1*mkplgc*_gcl_au*NzQ3NTcyODMzLjE3NDQwNjkyMDk.#display-management-api-keys%5C\" target=\"_blank\" rel=\"noopener\">Capella UI<\/a> or the <a href=\"https:\/\/docs.couchbase.com\/cloud\/management-api-reference\/index.html?_gl=1*1p9slku*_gcl_au*NzQ3NTcyODMzLjE3NDQwNjkyMDk.#tag\/apikeys\" target=\"_blank\" rel=\"noopener\">Capella Management API<\/a>. You must create an API key that has the right set of roles associated with it, depending on the scope of the resources managed by the provider.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>For information on setting the authorization and authentication, please refer to the Terraform <a href=\"https:\/\/github.com\/couchbasecloud\/terraform-provider-couchbase-capella\/blob\/main\/README.md#using-the-provider\" target=\"_blank\" rel=\"noopener\">repository<\/a> and this <a href=\"https:\/\/www.couchbase.com\/blog\/terraform-provider-couchbase-capella\/\" target=\"_blank\" rel=\"noopener\">blog<\/a> post.<\/p>\n<hr \/>\n<h3>Step 1: Configuration<\/h3>\n<h4>Create the variables<\/h4>\n<ol>\n<li>Create a file named <b><i>variables.tf<\/i><\/b> and add the following variable definitions. We will use these variables within our config file.\n<pre class=\"nums:false lang:default decode:true\">variable \"organization_id\" {\r\n\u00a0\u00a0description = \"Capella Organization ID\"\r\n}\r\n\r\nvariable \"project_id\" {\r\n\u00a0\u00a0description = \"Project Name for Project Created via Terraform\"\r\n}\r\n\r\nvariable \"cluster_id\" {\r\n\u00a0\u00a0description = \"Capella Cluster ID\"\r\n}\r\n\r\nvariable \"auth_token\" {\r\n\u00a0\u00a0description = \"Authentication API Key\"\r\n}<\/pre>\n<\/li>\n<li>Create a file named <b><i>terraform.template.tfvars<\/i><\/b> and add the following lines. Here, we specify the values of key variables associated with the deployment.\n<pre class=\"nums:false lang:default decode:true\">auth_token = \"&lt;replace-with-v4-api-key-secret&gt;\"\r\norganization_id = \"&lt;replace-with-the-oid-of-your-tenant&gt;\"\r\nproject_id = \"&lt;replace-with-the-projectid-of-your-project&gt;\"\r\ncluster_id = \"&lt;replace-with-the-clusterid-of-your-cluster&gt;\"<\/pre>\n<\/li>\n<li>Create a file named <b><i>capella.tf<\/i><\/b> and add the following configuration to create the On\/Off schedule for an existing Capella cluster in a project:\n<pre class=\"nums:false lang:default decode:true\">terraform {\r\nrequired_providers {\r\ncouchbase-capella = {\r\nsource\u00a0 = \"registry.terraform.io\/couchbasecloud\/couchbase-capella\"\r\n}\r\n}\r\n}\r\n\r\n# Configure the Couchbase Capella Provider using predefined variables\r\nprovider \"couchbase-capella\" {\r\nauthentication_token = var.auth_token\r\n}\r\n\r\n# Create an on off schedule for the cluster\r\nresource \"couchbase-capella_cluster_onoff_schedule\" \"new_cluster_onoff_schedule\"{\r\norganization_id = var.organization_id\r\nproject_id\u00a0 \u00a0 \u00a0 = var.project_id\r\ncluster_id\u00a0 \u00a0 \u00a0 = var.cluster_id\r\ntimezone = \"US\/Pacific\"\r\ndays = [\r\n{\r\nday \u00a0 = \"monday\"\r\nstate = \"custom\"\r\nfrom = {\r\nhour \u00a0 = 12\r\nminute = 30\r\n}\r\nto = {\r\nhour \u00a0 = 14\r\nminute = 30\r\n}\r\n},\r\n{\r\nday \u00a0 = \"tuesday\"\r\nstate = \"custom\"\r\nfrom = {\r\nhour = 12\r\n}\r\nto = {\r\nhour \u00a0 = 19\r\nminute = 30\r\n}\r\n},\r\n{\r\nday \u00a0 = \"wednesday\"\r\nstate = \"on\"\r\n},\r\n{\r\nday \u00a0 = \"thursday\"\r\nstate = \"custom\"\r\nfrom = {\r\nhour \u00a0 = 12\r\nminute = 30\r\n}\r\n},\r\n{\r\nday \u00a0 = \"friday\"\r\nstate = \"custom\"\r\nfrom = {\r\n\r\n\u00a0 \u00a0 }\r\nto = {\r\nhour \u00a0 = 12\r\nminute = 30\r\n}\r\n},\r\n{\r\nday \u00a0 = \"saturday\"\r\nstate = \"custom\"\r\nfrom = {\r\nhour \u00a0 = 12\r\nminute = 30\r\n}\r\nto = {\r\nhour = 14\r\n}\r\n},\r\n{\r\nday \u00a0 = \"sunday\"\r\nstate = \"off\"\r\n}\r\n]\r\n}\r\n\r\n# Stores the cluster onoff schedule details in an output variable.\r\n# Can be viewed using `terraform output cluster_onoff_schedule` command\r\noutput \"cluster_onoff_schedule\" {\r\nvalue = couchbase-capella_cluster_onoff_schedule.new_cluster_onoff_schedule\r\n}<\/pre>\n<\/li>\n<\/ol>\n<hr \/>\n<h3>Step 2: Deploy and Manage the Schedule<\/h3>\n<h4>Initialize the Terraform provider<\/h4>\n<p>Terraform must be initialized the very first time you use the provider:<\/p>\n<pre class=\"nums:false lang:default decode:true \">terraform init<\/pre>\n<h4>Review the Terraform plan<\/h4>\n<p>Use the following command to review the resources that will be deployed:<\/p>\n<pre class=\"nums:false lang:default decode:true \">terraform plan -var-file terraform.template.tfvars<\/pre>\n<p>You should see output similar to the following while creating an on\/off schedule for an existing cluster:<\/p>\n<pre class=\"nums:false lang:default decode:true\">Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:\r\n+ create\r\n\r\nTerraform will perform the following actions:\r\n\r\n\u00a0 # couchbase-capella_cluster_onoff_schedule.new_cluster_onoff_schedule will be created\r\n+ resource \"couchbase-capella_cluster_onoff_schedule\" \"new_cluster_onoff_schedule\" {\r\n+ cluster_id\u00a0 \u00a0 \u00a0 = \"1cd2a882-ddc2-497a-a9f9-60bd8da5488f\"\r\n+ days\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = [\r\n+ {\r\n+ day \u00a0 = \"monday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 14\r\n+ minute = 30\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"tuesday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 0\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 19\r\n+ minute = 30\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"wednesday\"\r\n+ state = \"on\"\r\n},\r\n+ {\r\n+ day \u00a0 = \"thursday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n+ state = \"custom\"\r\n},\r\n+ {\r\n+ day \u00a0 = \"friday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 0\r\n+ minute = 0\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"saturday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 14\r\n+ minute = 0\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"sunday\"\r\n+ state = \"off\"\r\n},\r\n]\r\n+ organization_id = \"7a99d00c-f55b-4b39-bc72-1b4cc68ba894\"\r\n+ project_id\u00a0 \u00a0 \u00a0 = \"9f837bbd-d1f3-476d-ac62-ba65a6548215\"\r\n+ timezone\u00a0 \u00a0 \u00a0 \u00a0 = \"US\/Pacific\"\r\n}\r\n\r\nPlan: 1 to add, 0 to change, 0 to destroy.\r\n\r\nChanges to Outputs:\r\n+ cluster_onoff_schedule = {\r\n+ cluster_id\u00a0 \u00a0 \u00a0 = \"1cd2a882-ddc2-497a-a9f9-60bd8da5488f\"\r\n+ days\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 = [\r\n+ {\r\n+ day \u00a0 = \"monday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 14\r\n+ minute = 30\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"tuesday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 0\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 19\r\n+ minute = 30\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"wednesday\"\r\n+ from\u00a0 = null\r\n+ state = \"on\"\r\n+ to\u00a0 \u00a0 = null\r\n},\r\n+ {\r\n+ day \u00a0 = \"thursday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = null\r\n},\r\n+ {\r\n+ day \u00a0 = \"friday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 0\r\n+ minute = 0\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"saturday\"\r\n+ from\u00a0 = {\r\n+ hour \u00a0 = 12\r\n+ minute = 30\r\n}\r\n+ state = \"custom\"\r\n+ to\u00a0 \u00a0 = {\r\n+ hour \u00a0 = 14\r\n+ minute = 0\r\n}\r\n},\r\n+ {\r\n+ day \u00a0 = \"sunday\"\r\n+ from\u00a0 = null\r\n+ state = \"off\"\r\n+ to\u00a0 \u00a0 = null\r\n},\r\n]\r\n+ organization_id = \"7a99d00c-f55b-4b39-bc72-1b4cc68ba894\"\r\n+ project_id\u00a0 \u00a0 \u00a0 = \"9f837bbd-d1f3-476d-ac62-ba65a6548215\"\r\n+ timezone\u00a0 \u00a0 \u00a0 \u00a0 = \"US\/Pacific\"\r\n}<\/pre>\n<h4>Execute the Terraform plan<\/h4>\n<p>Deploy the Couchbase Capella resources using the following command:<\/p>\n<pre class=\"nums:false lang:default decode:true \">terraform apply -var-file terraform.template.tfvars<\/pre>\n<p>Type \u201cyes\u201d if the plan looks good.<\/p>\n<p>Note: It will take a few minutes to deploy the resources if you are creating a project, deploying a cluster and creating an on\/off schedule for it.<\/p>\n<pre class=\"nums:false lang:default decode:true \">Do you want to perform these actions?\r\nTerraform will perform the actions described above.\r\nOnly 'yes' will be accepted to approve.\r\n\r\n\u00a0 Enter a value: yes\r\n\r\ncouchbase-capella_cluster_onoff_schedule.new_cluster_onoff_schedule: Creating...\r\ncouchbase-capella_cluster_onoff_schedule.new_cluster_onoff_schedule: Creation complete after 0s\r\n\r\nApply complete! Resources: 1 added, 0 changed, 0 destroyed.\r\n\r\nOutputs:\r\n\r\ncluster_onoff_schedule = {\r\n\"cluster_id\" = \"1cd2a882-ddc2-497a-a9f9-60bd8da5488f\"\r\n\"days\" = tolist([\r\n{\r\n\"day\" = \"monday\"\r\n\"from\" = {\r\n\"hour\" = 12\r\n\"minute\" = 30\r\n}\r\n\"state\" = \"custom\"\r\n\"to\" = {\r\n\"hour\" = 14\r\n\"minute\" = 30\r\n}\r\n},\r\n{\r\n\"day\" = \"tuesday\"\r\n\"from\" = {\r\n\"hour\" = 12\r\n\"minute\" = 0\r\n}\r\n\"state\" = \"custom\"\r\n\"to\" = {\r\n\"hour\" = 19\r\n\"minute\" = 30\r\n}\r\n},\r\n{\r\n\"day\" = \"wednesday\"\r\n\"from\" = null \/* object *\/\r\n\"state\" = \"on\"\r\n\"to\" = null \/* object *\/\r\n},\r\n{\r\n\"day\" = \"thursday\"\r\n\"from\" = {\r\n\"hour\" = 12\r\n\"minute\" = 30\r\n}\r\n\"state\" = \"custom\"\r\n\"to\" = null \/* object *\/\r\n},\r\n{\r\n\"day\" = \"friday\"\r\n\"from\" = {\r\n\"hour\" = 0\r\n\"minute\" = 0\r\n}\r\n\"state\" = \"custom\"\r\n\"to\" = {\r\n\"hour\" = 12\r\n\"minute\" = 30\r\n}\r\n},\r\n{\r\n\"day\" = \"saturday\"\r\n\"from\" = {\r\n\"hour\" = 12\r\n\"minute\" = 30\r\n}\r\n\"state\" = \"custom\"\r\n\"to\" = {\r\n\"hour\" = 14\r\n\"minute\" = 0\r\n}\r\n},\r\n{\r\n\"day\" = \"sunday\"\r\n\"from\" = null \/* object *\/\r\n\"state\" = \"off\"\r\n\"to\" = null \/* object *\/\r\n},\r\n])\r\n\"organization_id\" = \"7a99d00c-f55b-4b39-bc72-1b4cc68ba894\"\r\n\"project_id\" = \"9f837bbd-d1f3-476d-ac62-ba65a6548215\"\r\n\"timezone\" = \"US\/Pacific\"\r\n}<\/pre>\n<p>It would look like this on the Capella UI:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-17194\" style=\"border: 1px solid Gainsboro\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-1024x513.png\" alt=\"\" width=\"900\" height=\"451\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-1024x513.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-300x150.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-768x385.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-1536x770.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-18x9.png 18w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1-1320x662.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/image1-1.png 1999w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h4>Destroy the schedule<\/h4>\n<pre class=\"nums:false lang:default decode:true \">terraform destroy -var-file terraform.template.tfvars<\/pre>\n<hr \/>\n<h2>References<\/h2>\n<ul>\n<li style=\"list-style-type: none\">\n<ul>\n<li>Check out <a href=\"https:\/\/github.com\/couchbasecloud\/terraform-provider-couchbase-capella\/tree\/main\/examples\/cluster_onoff_schedule\" target=\"_blank\" rel=\"noopener\">Cluster On\/Off Schedule<\/a> using Terraform Provider.<\/li>\n<li>Check out the <a href=\"https:\/\/github.com\/couchbasecloud\/terraform-provider-couchbase-capella\/tree\/main\/examples\/cluster_onoff_ondemand\" target=\"_blank\" rel=\"noopener\">On-demand Cluster On\/Off<\/a> using Terraform Provider.<\/li>\n<li>Check out the <a href=\"https:\/\/github.com\/couchbasecloud\/terraform-provider-couchbase-capella\/tree\/main\/examples\/app_service_onoff_ondemand\" target=\"_blank\" rel=\"noopener\">On-demand App Service On\/Off<\/a> using Terraform Provider.<\/li>\n<li>Couchbase official docs for On-demand Cluster On\/Off &#8211; <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/off-on-database.html\" target=\"_blank\" rel=\"noopener\">ref<\/a><\/li>\n<li>Couchbase official docs for Cluster On\/Off Schedule &#8211; <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/off-on-schedule.html\" target=\"_blank\" rel=\"noopener\">ref<\/a><\/li>\n<li>Couchbase official docs for App Service On\/Off Schedule &#8211; <a href=\"https:\/\/docs.couchbase.com\/cloud\/management-api-reference\/index.html#tag\/App-Services\/operation\/appServiceOn\" target=\"_blank\" rel=\"noopener\">ref<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Couchbase Capella\u2019s Cluster On\/Off feature allows users to pause and resume their clusters seamlessly, without permanently deleting the data, helping optimise cloud expenses and improve operational efficiency. In this blog, we\u2019ll explore how this feature works and how you can [&hellip;]<\/p>\n","protected":false},"author":85629,"featured_media":17195,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,2242,2225],"tags":[1567,1308,9709,9913,9706,9912],"ppma_author":[10121],"class_list":["post-17193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-connectors","category-cloud","tag-continuous-deployment","tag-devops","tag-hashicorp","tag-infrastructure-as-code","tag-terraform","tag-terraform-provider"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Optimizing TCO: Automate Cluster Hibernation Using Terraform<\/title>\n<meta name=\"description\" content=\"Cut cloud costs with Couchbase Capella\u2019s Cluster On\/Off feature. Learn how to automate hibernation schedules using Terraform in this step-by-step guide.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Optimizing TCO: Automate Cluster Hibernation Using Terraform\" \/>\n<meta property=\"og:description\" content=\"Cut cloud costs with Couchbase Capella\u2019s Cluster On\/Off feature. Learn how to automate hibernation schedules using Terraform in this step-by-step guide.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-11T16:54:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-24T05:49:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1256\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Paulomee De - Software Engineer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paulomee De - Software Engineer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\"},\"author\":{\"name\":\"Paulomee De - Software Engineer\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/30c6ec0910cc6f052f8dab0a68060b92\"},\"headline\":\"Optimizing TCO: Automate Cluster Hibernation Using Terraform\",\"datePublished\":\"2025-06-11T16:54:25+00:00\",\"dateModified\":\"2025-06-24T05:49:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\"},\"wordCount\":971,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png\",\"keywords\":[\"Continuous Deployment\",\"DevOps\",\"hashicorp\",\"Infrastructure-as-Code\",\"terraform\",\"Terraform provider\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Connectors\",\"Couchbase Capella\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\",\"name\":\"Optimizing TCO: Automate Cluster Hibernation Using Terraform\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png\",\"datePublished\":\"2025-06-11T16:54:25+00:00\",\"dateModified\":\"2025-06-24T05:49:01+00:00\",\"description\":\"Cut cloud costs with Couchbase Capella\u2019s Cluster On\/Off feature. Learn how to automate hibernation schedules using Terraform in this step-by-step guide.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png\",\"width\":2400,\"height\":1256},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Optimizing TCO: Automate Cluster Hibernation Using Terraform\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/30c6ec0910cc6f052f8dab0a68060b92\",\"name\":\"Paulomee De - Software Engineer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/2a035ab322d90ea8cdb6c40a6e7c40c3\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/paulomee-couchbase.jpeg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/paulomee-couchbase.jpeg\",\"caption\":\"Paulomee De - Software Engineer\"},\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/paulomeede\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Optimizing TCO: Automate Cluster Hibernation Using Terraform","description":"Cut cloud costs with Couchbase Capella\u2019s Cluster On\/Off feature. Learn how to automate hibernation schedules using Terraform in this step-by-step guide.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/","og_locale":"en_US","og_type":"article","og_title":"Optimizing TCO: Automate Cluster Hibernation Using Terraform","og_description":"Cut cloud costs with Couchbase Capella\u2019s Cluster On\/Off feature. Learn how to automate hibernation schedules using Terraform in this step-by-step guide.","og_url":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/","og_site_name":"The Couchbase Blog","article_published_time":"2025-06-11T16:54:25+00:00","article_modified_time":"2025-06-24T05:49:01+00:00","og_image":[{"width":2400,"height":1256,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png","type":"image\/png"}],"author":"Paulomee De - Software Engineer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Paulomee De - Software Engineer","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/"},"author":{"name":"Paulomee De - Software Engineer","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/30c6ec0910cc6f052f8dab0a68060b92"},"headline":"Optimizing TCO: Automate Cluster Hibernation Using Terraform","datePublished":"2025-06-11T16:54:25+00:00","dateModified":"2025-06-24T05:49:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/"},"wordCount":971,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png","keywords":["Continuous Deployment","DevOps","hashicorp","Infrastructure-as-Code","terraform","Terraform provider"],"articleSection":["Best Practices and Tutorials","Connectors","Couchbase Capella"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/","url":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/","name":"Optimizing TCO: Automate Cluster Hibernation Using Terraform","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png","datePublished":"2025-06-11T16:54:25+00:00","dateModified":"2025-06-24T05:49:01+00:00","description":"Cut cloud costs with Couchbase Capella\u2019s Cluster On\/Off feature. Learn how to automate hibernation schedules using Terraform in this step-by-step guide.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/blog-hibernation-terraform.png","width":2400,"height":1256},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/automate-capella-cluster-onoff-terraform\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Optimizing TCO: Automate Cluster Hibernation Using Terraform"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/30c6ec0910cc6f052f8dab0a68060b92","name":"Paulomee De - Software Engineer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/2a035ab322d90ea8cdb6c40a6e7c40c3","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/paulomee-couchbase.jpeg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/paulomee-couchbase.jpeg","caption":"Paulomee De - Software Engineer"},"url":"https:\/\/www.couchbase.com\/blog\/author\/paulomeede\/"}]}},"authors":[{"term_id":10121,"user_id":85629,"is_guest":0,"slug":"paulomeede","display_name":"Paulomee De - Software Engineer","avatar_url":{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/paulomee-couchbase.jpeg","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2025\/06\/paulomee-couchbase.jpeg"},"author_category":"1","last_name":"De - Software Engineer","first_name":"Paulomee","job_title":"Software Engineer","user_url":"","description":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/17193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/85629"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=17193"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/17193\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/17195"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=17193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=17193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=17193"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=17193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}