> **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.
# ServerlessCacheAttributes

Attributes that can be specified when importing a 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.277.0/packages/@aws-cdk/aws-elasticache-alpha/lib/serverless-cache.ts#L174)

## Example

TypeScript:

```ts
declare const securityGroup: ec2.SecurityGroup;

const importedServerlessCache = elasticache.ServerlessCache.fromServerlessCacheAttributes(this, 'ImportedServerlessCache', {
  serverlessCacheName: 'my-serverless-cache',
  securityGroups: [securityGroup],
});
```

Python:

```python
# security_group: ec2.SecurityGroup

imported_serverless_cache = elasticache.ServerlessCache.from_serverless_cache_attributes(self, "ImportedServerlessCache",
    serverless_cache_name="my-serverless-cache",
    security_groups=[security_group]
)
```

Java:

```java
SecurityGroup securityGroup;

IServerlessCache importedServerlessCache = ServerlessCache.fromServerlessCacheAttributes(this, "ImportedServerlessCache", ServerlessCacheAttributes.builder()
        .serverlessCacheName("my-serverless-cache")
        .securityGroups(List.of(securityGroup))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ElastiCache.Alpha
SecurityGroup securityGroup;

var importedServerlessCache = ServerlessCache.FromServerlessCacheAttributes(this, "ImportedServerlessCache", new ServerlessCacheAttributes {
    ServerlessCacheName = "my-serverless-cache",
    SecurityGroups = new [] { securityGroup }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkelasticachealpha/v2
var securityGroup SecurityGroup

importedServerlessCache := elasticache.ServerlessCache_FromServerlessCacheAttributes(this, jsii.String("ImportedServerlessCache"), &ServerlessCacheAttributes{
	ServerlessCacheName: jsii.String("my-serverless-cache"),
	SecurityGroups: []ISecurityGroup{
		securityGroup,
	},
})
```

## Properties

- `backupArnsToRestore`: string[] — The ARNs of backups restored in the cache.

  **Default:** backups are unknown

- `engine`: [CacheEngine](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.CacheEngine.html) — The cache engine used by this cache.

  **Default:** engine type is unknown

- `kmsKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The KMS key used for encryption.

  **Default:** encryption key is unknown

- `securityGroups`: [ISecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — The security groups associated with this cache.

  **Default:** security groups are unknown

- `serverlessCacheArn`: string — The ARN of the serverless cache.

  **Default:** derived from serverlessCacheName

  One of `serverlessCacheName` or `serverlessCacheArn` is required.

- `serverlessCacheName`: string — The name of the serverless cache.

  **Default:** derived from serverlessCacheArn

  One of `serverlessCacheName` or `serverlessCacheArn` is required.

- `subnets`: [ISubnet](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISubnet.html)[] — The subnets this cache is deployed in.

  **Default:** subnets are unknown

- `userGroup`: [IUserGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-elasticache-alpha.IUserGroup.html) — The user group associated with this cache.

  **Default:** user group is unknown

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) — The VPC this cache is deployed in.

  **Default:** VPC is unknown
