|
| 1 | +# Create Your First Redis Cloud Database |
| 2 | + |
| 3 | +⏱️ **Time:** 5-10 minutes |
| 4 | +📋 **Prerequisites:** |
| 5 | +- Redis Cloud account ([sign up](https://redis.io/try-free/)) |
| 6 | +- redisctl installed ([installation guide](../../getting-started/installation.md)) |
| 7 | +- Profile configured with Cloud credentials ([authentication guide](../../getting-started/authentication.md)) |
| 8 | + |
| 9 | +## Quick Command |
| 10 | + |
| 11 | +If you already have a subscription, create a database with one command: |
| 12 | + |
| 13 | +```bash |
| 14 | +redisctl cloud database create \ |
| 15 | + --subscription-id YOUR_SUBSCRIPTION_ID \ |
| 16 | + --data '{"name": "my-first-db", "memoryLimitInGb": 1}' \ |
| 17 | + --wait |
| 18 | +``` |
| 19 | + |
| 20 | +## Step-by-Step Guide |
| 21 | + |
| 22 | +### 1. Verify Your Setup |
| 23 | + |
| 24 | +First, check that redisctl can connect to Redis Cloud: |
| 25 | + |
| 26 | +```bash |
| 27 | +redisctl cloud subscription list -o table |
| 28 | +``` |
| 29 | + |
| 30 | +**What you should see:** |
| 31 | +``` |
| 32 | +┌────┬─────────────────┬────────┬────────────┐ |
| 33 | +│ ID │ Name │ Status │ Provider │ |
| 34 | +├────┼─────────────────┼────────┼────────────┤ |
| 35 | +│ 42 │ my-subscription │ active │ AWS │ |
| 36 | +└────┴─────────────────┴────────┴────────────┘ |
| 37 | +``` |
| 38 | + |
| 39 | +**Troubleshooting:** |
| 40 | +- ❌ "401 Unauthorized" → Check your API credentials with `redisctl profile get` |
| 41 | +- ❌ Empty table → Create a subscription first (see [subscription guide](../cloud/subscriptions.md)) |
| 42 | + |
| 43 | +### 2. Choose Your Database Configuration |
| 44 | + |
| 45 | +Decide on your database specifications. Here's a minimal configuration: |
| 46 | + |
| 47 | +```json |
| 48 | +{ |
| 49 | + "name": "my-first-db", |
| 50 | + "memoryLimitInGb": 1, |
| 51 | + "protocol": "redis" |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +**Common options:** |
| 56 | +- `memoryLimitInGb`: Memory size (1-100+ GB) |
| 57 | +- `protocol`: `redis` or `memcached` |
| 58 | +- `dataPersistence`: `none`, `aof-every-1-second`, `snapshot-every-1-hour` |
| 59 | +- `replication`: `true` for high availability |
| 60 | + |
| 61 | +### 3. Create the Database |
| 62 | + |
| 63 | +Use the subscription ID from step 1: |
| 64 | + |
| 65 | +```bash |
| 66 | +redisctl cloud database create \ |
| 67 | + --subscription-id 42 \ |
| 68 | + --data '{ |
| 69 | + "name": "my-first-db", |
| 70 | + "memoryLimitInGb": 1, |
| 71 | + "protocol": "redis", |
| 72 | + "dataPersistence": "aof-every-1-second", |
| 73 | + "replication": true |
| 74 | + }' \ |
| 75 | + --wait \ |
| 76 | + --wait-timeout 300 |
| 77 | +``` |
| 78 | + |
| 79 | +**What's happening:** |
| 80 | +- `--wait`: Waits for database to become active |
| 81 | +- `--wait-timeout 300`: Waits up to 5 minutes |
| 82 | +- Without `--wait`: Returns immediately with task ID |
| 83 | + |
| 84 | +**What you should see:** |
| 85 | + |
| 86 | +```json |
| 87 | +{ |
| 88 | + "taskId": "abc123...", |
| 89 | + "status": "processing" |
| 90 | +} |
| 91 | +... |
| 92 | +Database creation completed successfully! |
| 93 | +{ |
| 94 | + "database_id": 12345, |
| 95 | + "name": "my-first-db", |
| 96 | + "status": "active", |
| 97 | + "public_endpoint": "redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com:12345" |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +### 4. Get Your Connection Details |
| 102 | + |
| 103 | +Retrieve your database credentials: |
| 104 | + |
| 105 | +```bash |
| 106 | +redisctl cloud database get \ |
| 107 | + --subscription-id 42 \ |
| 108 | + --database-id 12345 \ |
| 109 | + -o json \ |
| 110 | + -q '{endpoint: public_endpoint, password: password}' |
| 111 | +``` |
| 112 | + |
| 113 | +**Output:** |
| 114 | +```json |
| 115 | +{ |
| 116 | + "endpoint": "redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com:12345", |
| 117 | + "password": "your-password-here" |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +### 5. Test Your Connection |
| 122 | + |
| 123 | +Using redis-cli: |
| 124 | + |
| 125 | +```bash |
| 126 | +redis-cli -h redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com \ |
| 127 | + -p 12345 \ |
| 128 | + -a your-password-here \ |
| 129 | + PING |
| 130 | +``` |
| 131 | + |
| 132 | +Expected response: `PONG` |
| 133 | + |
| 134 | +## Advanced Options |
| 135 | + |
| 136 | +### Using a JSON File |
| 137 | + |
| 138 | +For complex configurations, use a file: |
| 139 | + |
| 140 | +```bash |
| 141 | +# Create database-config.json |
| 142 | +cat > database-config.json << 'EOF' |
| 143 | +{ |
| 144 | + "name": "production-db", |
| 145 | + "memoryLimitInGb": 10, |
| 146 | + "protocol": "redis", |
| 147 | + "dataPersistence": "aof-every-1-second", |
| 148 | + "replication": true, |
| 149 | + "throughputMeasurement": { |
| 150 | + "by": "operations-per-second", |
| 151 | + "value": 25000 |
| 152 | + }, |
| 153 | + "dataEvictionPolicy": "volatile-lru", |
| 154 | + "modules": [ |
| 155 | + {"name": "RedisJSON"} |
| 156 | + ] |
| 157 | +} |
| 158 | +EOF |
| 159 | + |
| 160 | +# Create database |
| 161 | +redisctl cloud database create \ |
| 162 | + --subscription-id 42 \ |
| 163 | + --data @database-config.json \ |
| 164 | + --wait |
| 165 | +``` |
| 166 | + |
| 167 | +### JSON Output for Automation |
| 168 | + |
| 169 | +Use `-o json` for scripts: |
| 170 | + |
| 171 | +```bash |
| 172 | +DB_INFO=$(redisctl cloud database create \ |
| 173 | + --subscription-id 42 \ |
| 174 | + --data '{"name": "api-cache", "memoryLimitInGb": 2}' \ |
| 175 | + --wait \ |
| 176 | + -o json) |
| 177 | + |
| 178 | +DB_ID=$(echo "$DB_INFO" | jq -r '.database_id') |
| 179 | +echo "Created database: $DB_ID" |
| 180 | +``` |
| 181 | + |
| 182 | +## Common Issues |
| 183 | + |
| 184 | +### Database Creation Times Out |
| 185 | + |
| 186 | +``` |
| 187 | +Error: Database creation timed out after 300 seconds |
| 188 | +``` |
| 189 | + |
| 190 | +**Solution:** Some regions take longer. Increase timeout: |
| 191 | +```bash |
| 192 | +redisctl cloud database create ... --wait --wait-timeout 600 |
| 193 | +``` |
| 194 | + |
| 195 | +### Insufficient Subscription Capacity |
| 196 | + |
| 197 | +``` |
| 198 | +Error: Subscription has insufficient capacity |
| 199 | +``` |
| 200 | + |
| 201 | +**Solution:** Either: |
| 202 | +1. Delete unused databases: `redisctl cloud database delete ...` |
| 203 | +2. Upgrade subscription: Contact Redis support or use the web console |
| 204 | + |
| 205 | +### Invalid Configuration |
| 206 | + |
| 207 | +``` |
| 208 | +Error: 400 Bad Request - Invalid memory limit |
| 209 | +``` |
| 210 | + |
| 211 | +**Solution:** Check subscription limits: |
| 212 | +```bash |
| 213 | +redisctl cloud subscription get --subscription-id 42 -q 'pricing' |
| 214 | +``` |
| 215 | + |
| 216 | +## Next Steps |
| 217 | + |
| 218 | +Now that you have a database: |
| 219 | + |
| 220 | +- 🔒 [Configure ACL Security](configure-acls.md) - Secure your database with access controls |
| 221 | +- 🌐 [Set Up VPC Peering](setup-vpc-peering.md) - Connect to your private network |
| 222 | +- 💾 [Configure Backups](backup-restore.md) - Protect your data |
| 223 | +- 📊 [Monitor Performance](../../guides/monitoring.md) - Track your database metrics |
| 224 | + |
| 225 | +## See Also |
| 226 | + |
| 227 | +- [Cloud Database Command Reference](../../cloud/core-resources/databases.md) - Complete command documentation |
| 228 | +- [Database Configuration Guide](../../cloud/database-configuration.md) - All configuration options |
| 229 | +- [Redis Cloud Pricing](https://redis.io/pricing/) - Understand costs |
0 commit comments