ServiceManagedEBSVolumeConfiguration Struct
Represents the configuration for an ECS Service managed EBS volume.
Example
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
Default: Default Amazon EBS encryption.
fileSystemTypeFileSystemTypefile_system_typeFileSystemTypefileSystemTypeFileSystemTypeFileSystemTypeFileSystemTypeFileSystemTypeFileSystemType= FileSystemType.XFS#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.
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.
Default: When encryption is turned on and no kmsKey is specified, the default AWS managed key for Amazon EBS volumes is used.
Default: automatically generated role.
This role is required to create and manage the Amazon EBS volume.
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
Default: No snapshot.
You must specify either size or snapshotId.
tagSpecificationsEBSTagSpecification[]tag_specificationstyping.List[EBSTagSpecification]tagSpecificationsList<EBSTagSpecification>TagSpecificationsEBSTagSpecification[]TagSpecifications*[]EBSTagSpecification#Default: No tags are specified.
Default: No throughput.
This parameter is only supported for the gp3 volume type.
volumeInitializationRateSizevolume_initialization_rateSizevolumeInitializationRateSizeVolumeInitializationRateSizeVolumeInitializationRateSize#Default: undefined - The volume initialization rate is not set.
Valid range is between 100 and 300 MiB/s.
volumeTypeEbsDeviceVolumeTypevolume_typeEbsDeviceVolumeTypevolumeTypeEbsDeviceVolumeTypeVolumeTypeEbsDeviceVolumeTypeVolumeTypeEbsDeviceVolumeType= ec2.EbsDeviceVolumeType.GP2#