Gallery
Search…
Defining Cached Services

Create a Terraform Configuration

The first step to creating a cached service is to create an infrastructure as code representation of the service. Make sure you define terraform outputs for any values that will need to be used in templates in the future -- otherwise they will not be accessible! For example, if you would like to define a MySQL AWS RDS cached service, you can use the following terraform snippet:
1
resource "aws_db_instance" "default" {
2
allocated_storage = 20
3
engine = "postgresql"
4
engine_version = "12.2"
5
instance_class = "db.t3.micro"
6
name = var.database_name
7
username = var.database_user
8
password = var.database_password
9
skip_final_snapshot = true
10
}
11
12
output "db_name" {
13
value = aws_db_instance.default.name
14
}
Copied!

Snapshots

If your DBMS supports snapshotting, you can specify snapshots in your IaC templates to get pre-seeded databases.
Now, you can go to the cached services tab, name your cached service, and select the cloud providers you need to use in your terraform file. You'll use the cached service name as an identifier to access cached service resources in your template IaC scripts.
Now link your terraform definition with Gallery. You can either use a terraform snippet or a repository.
Once you create your cached service, instances of your services will start spinning up (up to the minimum replicas you initially indicated).

Scaling

You can adjust the number of active cached service instances from the cached service page. Just hit edit, adjust the minimum number of instances and hit save to scale up or down the number of idle cached services that are running at any time.

Use in Templates

You can now use your cached services in templates. Take a look at Using Cached Services for more information.
Last modified 25d ago