0

Update Redis instance

by
Published Oct 17, 2025

Update a Redis instance by ID.

Script render Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Render = {
3
	apiKey: string
4
}
5
/**
6
 * Update Redis instance
7
 * Update a Redis instance by ID.
8

9
 */
10
export async function main(
11
	auth: Render,
12
	redisId: string,
13
	body: {
14
		name?: string
15
		plan?: 'free' | 'starter' | 'standard' | 'pro' | 'pro_plus' | 'custom'
16
		maxmemoryPolicy?:
17
			| 'noeviction'
18
			| 'allkeys_lfu'
19
			| 'allkeys_lru'
20
			| 'allkeys_random'
21
			| 'volatile_lfu'
22
			| 'volatile_lru'
23
			| 'volatile_random'
24
			| 'volatile_ttl'
25
		ipAllowList?: { cidrBlock: string; description: string }[]
26
	}
27
) {
28
	const url = new URL(`https://api.render.com/v1/redis/${redisId}`)
29

30
	const response = await fetch(url, {
31
		method: 'PATCH',
32
		headers: {
33
			'Content-Type': 'application/json',
34
			Authorization: 'Bearer ' + auth.apiKey
35
		},
36
		body: JSON.stringify(body)
37
	})
38
	if (!response.ok) {
39
		const text = await response.text()
40
		throw new Error(`${response.status} ${text}`)
41
	}
42
	return await response.json()
43
}
44