# ServiceManagedEBSVolumeConfiguration

Represents the configuration for an ECS Service managed EBS volume.

- Source: [`aws-ecs/lib/base/service-managed-volume.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/base/service-managed-volume.ts#L30)
- Type last changed: v2.214.0 · 2 Sep 2025

## Example

```ts
declare const cluster: ecs.Cluster;
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef');

const container = taskDefinition.addContainer('web', {
  image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
  portMappings: [{
    containerPort: 80,
    protocol: ecs.Protocol.TCP,
  }],
});

const volume = new ecs.ServiceManagedVolume(this, 'EBSVolume', {
  name: 'ebs1',
  managedEBSVolume: {
    size: Size.gibibytes(15),
    volumeType: ec2.EbsDeviceVolumeType.GP3,
    fileSystemType: ecs.FileSystemType.XFS,
    tagSpecifications: [{
      tags: {
        purpose: 'production',
      },
      propagateTags: ecs.EbsPropagatedTagSource.SERVICE,
    }],
  },
});

volume.mountIn(container, {
  containerPath: '/var/lib',
  readOnly: false,
});

taskDefinition.addVolume(volume);

const service = new ecs.FargateService(this, 'FargateService', {
  cluster,
  taskDefinition,
  minHealthyPercent: 100,
});

service.addVolume(volume);
```

## Properties

- `encrypted`: boolean — Indicates whether the volume should be encrypted.

  **Default:** Default Amazon EBS encryption.

- `fileSystemType`: [FileSystemType](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.FileSystemType.html) = FileSystemType.XFS — The Linux filesystem type for the volume.

  For volumes created from a snapshot, you must specify the same filesystem type that
  the volume was using when the snapshot was created.
  The available filesystem types are ext3, ext4, and xfs.

- `iops`: number = undefined — The number of I/O operations per second (IOPS).

  For gp3, io1, and io2 volumes, this represents the number of IOPS that are provisioned
  for the volume. For gp2 volumes, this represents the baseline performance of the volume
  and the rate at which the volume accumulates I/O credits for bursting.

  The following are the supported values for each volume type.
    - gp3: 3,000 - 16,000 IOPS
    - io1: 100 - 64,000 IOPS
    - io2: 100 - 256,000 IOPS

  This parameter is required for io1 and io2 volume types. The default for gp3 volumes is
  3,000 IOPS. This parameter is not supported for st1, sc1, or standard volume types.

- `kmsKeyId`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — AWS Key Management Service key to use for Amazon EBS encryption.

  **Default:** When `encryption` is turned on and no `kmsKey` is specified, the default AWS managed key for Amazon EBS volumes is used.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — An IAM role that allows ECS to make calls to EBS APIs on your behalf.

  **Default:** automatically generated role.

  This role is required to create and manage the Amazon EBS volume.

- `size`: [Size](/cdk/api/v2/docs/aws-cdk-lib.Size.html) — The size of the volume in GiB.

  **Default:** The snapshot size is used for the volume size if you specify `snapshotId`, otherwise this parameter is required.

  You must specify either `size` or `snapshotId`.
  You can optionally specify a volume size greater than or equal to the snapshot size.

  The following are the supported volume size values for each volume type.
    - gp2 and gp3: 1-16,384
    - io1 and io2: 4-16,384
    - st1 and sc1: 125-16,384
    - standard: 1-1,024

- `snapShotId`: string — The snapshot that Amazon ECS uses to create the volume.

  **Default:** No snapshot.

  You must specify either `size` or `snapshotId`.

- `tagSpecifications`: [EBSTagSpecification](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.EBSTagSpecification.html)[] — Specifies the tags to apply to the volume and whether to propagate those tags to the volume.

  **Default:** No tags are specified.

- `throughput`: number — The throughput to provision for a volume, in MiB/s, with a maximum of 1,000 MiB/s.

  **Default:** No throughput.

  This parameter is only supported for the gp3 volume type.

- `volumeInitializationRate`: [Size](/cdk/api/v2/docs/aws-cdk-lib.Size.html) — Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), at which to download the snapshot blocks from Amazon S3 to the volume.

  **Default:** undefined - The volume initialization rate is not set.

  Valid range is between 100 and 300 MiB/s.

- `volumeType`: [EbsDeviceVolumeType](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.EbsDeviceVolumeType.html) = ec2.EbsDeviceVolumeType.GP2 — The volume type.
