Create a Memorystore for Redis instance by using the Google Cloud console
Learn how to create a new Memorystore for Redis instance, connect to it, and then delete it.
To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
Creating a Redis instance
- Go to the Memorystore for Redis page in the Google Cloud console.
Memorystore for Redis
If the Memorystore page is unavailable, enable or re-enable the Memorystore for Redis API.
Enable the API - Click Create Instance.
On the Create a Redis instance page, select the configurations for your new instance.
- Enter
my-instance-1
under Instance ID. - Enter
My Quickstart Instance
under Display name. - Choose Basic under the Tier selector.
- Basic Tier designates a standalone Redis node, as opposed to Standard Tier, which uses a replica node to backup your data.
- Choose
us-central1
from the Region dropdown. - Choose
any
from the Zone dropdown. - Enter
5
under Capacity.- This sets your instance capacity to 5 GB.
- Under Version, select
5.0 (recommended)
. - Choose
default
from the Authorized network dropdown.
- Enter
Click the Create button.
Your instance is created.
After the instance is created, obtain your instance's
IP address
by following these steps:- Go to the Memorystore for Redis page in the Google Cloud console.
Memorystore for Redis - Click on the ID of the instance:
my-instance-1
. - Under Connection properties, take a note of your instance's
IP address
. - Also note that your instance's Port number is
6379
.
- Go to the Memorystore for Redis page in the Google Cloud console.
Connecting to the Redis instance from a Compute Engine VM instance
You can connect to the Redis instance from any Compute Engine VM that uses the Redis instance's authorized network with a supported RFC 1918 IP address.
If you don't already have a Compute Engine VM that uses that same authorized network as your Redis instance, create one and connect to it by following Quickstart using a Linux VM.
Install
telnet
usingapt-get
:sudo apt-get install telnet
From the terminal, telnet to the IP address of the Redis instance, replacing variables with appropriate values.
telnet instance-ip-address 6379
If successful, the command will return this result:
Trying instance-ip-address… Connected to instance-ip-address
In the telnet session, enter some Redis commands:
Enter:
PING
Result:
PONG
Enter
SET HELLO WORLD
Result:
+OK
Enter:
GET HELLO
Result:
$5 WORLD
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
To avoid incurring charges to your Google Cloud account for the resources used in this quickstart:
- Go to the Memorystore for Redis page in the Google Cloud console.
Memorystore for Redis - Click the instance ID of the instance you want to delete.
- Click the Delete button.
- In the prompt that appears, enter the instance ID.
- Click Delete.
What's next
- Learn more about creating and managing instances.
- Learn about other ways to connect to your Redis instance.
- Learn about the characteristics of a Redis instance.