createSnapshot
inline suspend fun ElastiCacheClient.createSnapshot(crossinline block: CreateSnapshotRequest.Builder.() -> Unit): CreateSnapshotResponse
Creates a copy of an entire cluster or replication group at a specific moment in time.
This operation is valid for Valkey or Redis OSS only.
Samples
fun main() {
//sampleStart
// Creates a snapshot of a non clustered Redis cluster that has only three nodes, primary and two read
// replicas. CacheClusterId must be a specific node in the cluster.
val resp = elastiCacheClient.createSnapshot {
cacheClusterId = "threenoderedis-001"
snapshotName = "snapshot-2"
}
//sampleEnd
}
fun main() {
//sampleStart
// Creates a snapshot of a non clustered Redis cluster that has only one node.
val resp = elastiCacheClient.createSnapshot {
cacheClusterId = "onenoderedis"
snapshotName = "snapshot-1"
}
//sampleEnd
}
fun main() {
//sampleStart
// Creates a snapshot of a clustered Redis cluster that has 2 shards, each with a primary and 4 read
// replicas.
val resp = elastiCacheClient.createSnapshot {
replicationGroupId = "clusteredredis"
snapshotName = "snapshot-2x5"
}
//sampleEnd
}