1. Answers
  2. Configuring an Azure Redis Cache

How do I configure an Azure Redis cache?

This guide explains how to configure an Azure Redis Cache using infrastructure as code. Azure Redis Cache is a managed in-memory cache that enables high performance and scalability, ideal for applications requiring fast access to data.

Resources in this Configuration:

  • azurerm_resource_group: A resource group to contain the Redis cache.
  • azurerm_redis_cache: The Redis cache resource.

Steps:

  1. Define an Azure Resource Group to group your resources.
  2. Create an Azure Redis Cache within the resource group.

Here is the complete code:

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

// Resource Group
const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West US",
});
// Redis Cache
const exampleCache = new azure.redis.Cache("example", {
    name: "example-cache",
    location: example.location,
    resourceGroupName: example.name,
    capacity: 1,
    family: "C",
    skuName: "Basic",
});
export const redisCacheName = exampleCache.name;
export const redisCacheHostname = exampleCache.hostname;
export const redisCachePort = exampleCache.port;
export const redisCachePrimaryAccessKey = exampleCache.primaryAccessKey;

This configuration script sets up an Azure Resource Group and within that, provisions an Azure Redis Cache instance with the Basic SKU. Subsequently, it exports the cache name, hostname, port, and primary access key for further use.

In summary, you have created an Azure Redis Cache and outputted relevant connection information. This setup is essential for running high-performance applications that need fast data access and retrieval.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up