Skip to main content

Redis Enterprise Cloud AWS Example

A minimal TypeScript Pulumi program

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set redis-cloud-aws-ts
cd pulumi-examples/redis-cloud-aws-ts

This example contains code that creates a Redis Enterprise Cloud cluster and connects it to an AWS VPC via VPC Peering. This stack also includes an EC2 instance with SSM Session Manager that can run Redis commands to verify connectivity to the Redis cluster.

Architecture diagram of an AWS VPC across 3 availability zones, connected to Redis Enterprise Cloud via VPC peering

Prerequisites#

  1. Install Pulumi
  2. Configure the Redis Cloud provider
  3. Ensure you have a payment method specified in the Redis Enterprise Cloud console.
  4. Configure the AWS Classic provider
  5. Install NodeJS

Deploy the app#

  1. Set configuration values for your Redis Cloud payment information:

    Terminal window
    pulumi config set cardType <YOUR-CARD-TYPE> # e.g. Visa (capitalization matters)
    pulumi config set lastFourNumbers 1234
  2. If you are using an availability zone other than us-east-1, you will need to set preferredAz, e.g. if you’re using us-west-2:

    Terminal window
    pulumi config set aws:region us-west-2 # Not necessary if your default AWS region is e.g. us-west-2
    pulumi config set preferredAz usw2-az1 # This step is necessary is your default or selected region is not us-east-1
  3. Deploy the architecture:

    Terminal window
    pulumi up

Test the architecture#

  1. In the AWS Console, find the EC2 instance named pulumi-redis-cloud-tester, and connect to it via SSM Systems Manager:

    AWS EC2 console, listing available instances AWS EC2 connect dialog

  2. In the Redis Cloud console, locate your database, and select “Connect”:

  3. In the connection dialog, copy the connection info for the Redis CLI:

    Redis Cloud console showing the connection dialog with the CLI option selected

  4. Paste the command into the Systems Manager shell prompt, which will connect you to the Redis instance. From there you can run Redis commands like INCR that will write to the Redis cluster:

    SSM Systems Manager shell with commands like redis connect and INCR

Clean up#

  1. Run pulumi destroy to tear down all resources.
  2. To delete the stack itself, run pulumi stack rm. Note that this command deletes all deployment history from the Pulumi Cloud console.

Related

The infrastructure as code platform for any cloud.