Skip to content
v2.274.0

ServiceManagedEBSVolumeConfiguration Struct ​

Represents the configuration for an ECS Service managed EBS volume.

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 ​

encryptedbooleanencryptedboolencryptedBooleanEncryptedboolEncrypted*bool#
Indicates whether the volume should be encrypted.

Default: Default Amazon EBS encryption.

fileSystemTypeFileSystemTypefile_system_typeFileSystemTypefileSystemTypeFileSystemTypeFileSystemTypeFileSystemTypeFileSystemTypeFileSystemType= 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.

iopsnumberiopsint | floatiopsNumberIopsdoubleIops*float64= undefined#
The number of I/O operations per second (IOPS).
notes

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.

kmsKeyIdIKeykms_key_idIKeykmsKeyIdIKeyKmsKeyIdIKeyKmsKeyIdIKey#
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.

roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole#
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.

sizeSizesizeSizesizeSizeSizeSizeSizeSize#
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.

notes

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
snapShotIdstringsnap_shot_idstrsnapShotIdStringSnapShotIdstringSnapShotId*string#
The snapshot that Amazon ECS uses to create the volume.

Default: No snapshot.

You must specify either size or snapshotId.

tagSpecificationsEBSTagSpecification[]tag_specificationstyping.List[EBSTagSpecification]tagSpecificationsList<EBSTagSpecification>TagSpecificationsEBSTagSpecification[]TagSpecifications*[]EBSTagSpecification#
Specifies the tags to apply to the volume and whether to propagate those tags to the volume.

Default: No tags are specified.

throughputnumberthroughputint | floatthroughputNumberThroughputdoubleThroughput*float64#
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.

volumeInitializationRateSizevolume_initialization_rateSizevolumeInitializationRateSizeVolumeInitializationRateSizeVolumeInitializationRateSize#
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.

volumeTypeEbsDeviceVolumeTypevolume_typeEbsDeviceVolumeTypevolumeTypeEbsDeviceVolumeTypeVolumeTypeEbsDeviceVolumeTypeVolumeTypeEbsDeviceVolumeType= ec2.EbsDeviceVolumeType.GP2#
The volume type.