> **Experimental**
>
> `@aws-cdk/aws-elasticache-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# BackupSettings

Backup configuration for ServerlessCache.

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/serverless-cache.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-elasticache-alpha/lib/serverless-cache.ts#L78)

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;

const serverlessCache = new elasticache.ServerlessCache(this, 'ServerlessCache', {
  engine: elasticache.CacheEngine.VALKEY_LATEST,
  backup: {
    // set a backup name before deleting a cache
    backupNameBeforeDeletion: "my-final-backup-name",
  },
  vpc,
});
```

Python:

```python
# vpc: ec2.Vpc

serverless_cache = elasticache.ServerlessCache(self, "ServerlessCache",
    engine=elasticache.CacheEngine.VALKEY_LATEST,
    backup=elasticache.BackupSettings(
        # set a backup name before deleting a cache
        backup_name_before_deletion="my-final-backup-name"
    ),
    vpc=vpc
)
```

Java:

```java
Vpc vpc;

ServerlessCache serverlessCache = ServerlessCache.Builder.create(this, "ServerlessCache")
        .engine(CacheEngine.VALKEY_LATEST)
        .backup(BackupSettings.builder()
                // set a backup name before deleting a cache
                .backupNameBeforeDeletion("my-final-backup-name")
                .build())
        .vpc(vpc)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
Vpc vpc;

var serverlessCache = new ServerlessCache(this, "ServerlessCache", new ServerlessCacheProps {
    Engine = CacheEngine.VALKEY_LATEST,
    Backup = new BackupSettings {
        // set a backup name before deleting a cache
        BackupNameBeforeDeletion = "my-final-backup-name"
    },
    Vpc = vpc
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
var vpc Vpc

serverlessCache := elasticache.NewServerlessCache(this, jsii.String("ServerlessCache"), &ServerlessCacheProps{
	Engine: elasticache.CacheEngine_VALKEY_LATEST(),
	Backup: &BackupSettings{
		// set a backup name before deleting a cache
		BackupNameBeforeDeletion: jsii.String("my-final-backup-name"),
	},
	Vpc: Vpc,
})
```

## Properties

- `backupArnsToRestore`: string[] — ARNs of backups from which to restore data into the new cache.

  **Default:** Create a new cache with no existing data

- `backupNameBeforeDeletion`: string — Name for the final backup taken before deletion.

  **Default:** No final backup

- `backupRetentionLimit`: number — Number of days to retain backups (1-35).

  **Default:** Backups are not retained

- `backupTime`: [Schedule](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Schedule.html) — Automated daily backup UTC time.

  **Default:** No automated backups
