Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Create Your First Redis Cloud Database

⏱️ Time: 5-10 minutes
📋 Prerequisites:

Quick Command

If you already have a subscription, create a database with one command:

redisctl cloud database create \
  --subscription-id YOUR_SUBSCRIPTION_ID \
  --data '{"name": "my-first-db", "memoryLimitInGb": 1}' \
  --wait

Step-by-Step Guide

1. Verify Your Setup

First, check that redisctl can connect to Redis Cloud:

redisctl cloud subscription list -o table

What you should see:

┌────┬─────────────────┬────────┬────────────┐
│ ID │ Name            │ Status │ Provider   │
├────┼─────────────────┼────────┼────────────┤
│ 42 │ my-subscription │ active │ AWS        │
└────┴─────────────────┴────────┴────────────┘

Troubleshooting:

  • ❌ "401 Unauthorized" → Check your API credentials with redisctl profile get
  • ❌ Empty table → Create a subscription first (see subscription guide)

2. Choose Your Database Configuration

Decide on your database specifications. Here's a minimal configuration:

{
  "name": "my-first-db",
  "memoryLimitInGb": 1,
  "protocol": "redis"
}

Common options:

  • memoryLimitInGb: Memory size (1-100+ GB)
  • protocol: redis or memcached
  • dataPersistence: none, aof-every-1-second, snapshot-every-1-hour
  • replication: true for high availability

3. Create the Database

Use the subscription ID from step 1:

redisctl cloud database create \
  --subscription-id 42 \
  --data '{
    "name": "my-first-db",
    "memoryLimitInGb": 1,
    "protocol": "redis",
    "dataPersistence": "aof-every-1-second",
    "replication": true
  }' \
  --wait \
  --wait-timeout 300

What's happening:

  • --wait: Waits for database to become active
  • --wait-timeout 300: Waits up to 5 minutes
  • Without --wait: Returns immediately with task ID

What you should see:

{
  "taskId": "abc123...",
  "status": "processing"
}
...
Database creation completed successfully!
{
  "database_id": 12345,
  "name": "my-first-db",
  "status": "active",
  "public_endpoint": "redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com:12345"
}

4. Get Your Connection Details

Retrieve your database credentials:

redisctl cloud database get \
  --subscription-id 42 \
  --database-id 12345 \
  -o json \
  -q '{endpoint: public_endpoint, password: password}'

Output:

{
  "endpoint": "redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com:12345",
  "password": "your-password-here"
}

5. Test Your Connection

Using redis-cli:

redis-cli -h redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com \
  -p 12345 \
  -a your-password-here \
  PING

Expected response: PONG

Advanced Options

Using a JSON File

For complex configurations, use a file:

# Create database-config.json
cat > database-config.json << 'EOF'
{
  "name": "production-db",
  "memoryLimitInGb": 10,
  "protocol": "redis",
  "dataPersistence": "aof-every-1-second",
  "replication": true,
  "throughputMeasurement": {
    "by": "operations-per-second",
    "value": 25000
  },
  "dataEvictionPolicy": "volatile-lru",
  "modules": [
    {"name": "RedisJSON"}
  ]
}
EOF

# Create database
redisctl cloud database create \
  --subscription-id 42 \
  --data @database-config.json \
  --wait

JSON Output for Automation

Use -o json for scripts:

DB_INFO=$(redisctl cloud database create \
  --subscription-id 42 \
  --data '{"name": "api-cache", "memoryLimitInGb": 2}' \
  --wait \
  -o json)

DB_ID=$(echo "$DB_INFO" | jq -r '.database_id')
echo "Created database: $DB_ID"

Common Issues

Database Creation Times Out

Error: Database creation timed out after 300 seconds

Solution: Some regions take longer. Increase timeout:

redisctl cloud database create ... --wait --wait-timeout 600

Insufficient Subscription Capacity

Error: Subscription has insufficient capacity

Solution: Either:

  1. Delete unused databases: redisctl cloud database delete ...
  2. Upgrade subscription: Contact Redis support or use the web console

Invalid Configuration

Error: 400 Bad Request - Invalid memory limit

Solution: Check subscription limits:

redisctl cloud subscription get --subscription-id 42 -q 'pricing'

Next Steps

Now that you have a database:

See Also