# ManagedStorageConfiguration

Kms Keys for encryption ECS managed storage.

- Source: [`aws-ecs/lib/cluster.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecs/lib/cluster.ts#L1524)
- Type last changed: v2.224.0 · 13 Nov 2025

## Example

TypeScript:

```ts
declare const key: kms.Key;

const cluster = new ecs.Cluster(this, 'Cluster', {
  managedStorageConfiguration: {
    fargateEphemeralStorageKmsKey: key,
    kmsKey: key,
  },
});
```

Python:

```python
# key: kms.Key

cluster = ecs.Cluster(self, "Cluster",
    managed_storage_configuration=ecs.ManagedStorageConfiguration(
        fargate_ephemeral_storage_kms_key=key,
        kms_key=key
    )
)
```

Java:

```java
Key key;

Cluster cluster = Cluster.Builder.create(this, "Cluster")
        .managedStorageConfiguration(ManagedStorageConfiguration.builder()
                .fargateEphemeralStorageKmsKey(key)
                .kmsKey(key)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Key key;

var cluster = new Cluster(this, "Cluster", new ClusterProps {
    ManagedStorageConfiguration = new ManagedStorageConfiguration {
        FargateEphemeralStorageKmsKey = key,
        KmsKey = key
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var key Key

cluster := ecs.NewCluster(this, jsii.String("Cluster"), &ClusterProps{
	ManagedStorageConfiguration: &ManagedStorageConfiguration{
		FargateEphemeralStorageKmsKey: key,
		KmsKey: key,
	},
})
```

## Properties

- `fargateEphemeralStorageKmsKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — Customer KMS Key used to encrypt ECS Fargate ephemeral Storage.

  **Default:** Encrypted using AWS-managed key

  The configured KMS Key's policy will be modified to allow ECS to use the Key to encrypt the ephemeral Storage for this cluster.

- `kmsKey`: [IKeyRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_kms.IKeyRef.html) — Customer KMS Key used to encrypt ECS managed Storage.

  **Default:** Encrypted using AWS-managed key
