interface ServiceManagedEBSVolumeConfiguration
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.ECS.ServiceManagedEBSVolumeConfiguration |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#ServiceManagedEBSVolumeConfiguration |
![]() | software.amazon.awscdk.services.ecs.ServiceManagedEBSVolumeConfiguration |
![]() | aws_cdk.aws_ecs.ServiceManagedEBSVolumeConfiguration |
![]() | aws-cdk-lib » aws_ecs » ServiceManagedEBSVolumeConfiguration |
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
Name | Type | Description |
---|---|---|
encrypted? | boolean | Indicates whether the volume should be encrypted. |
file | File | The Linux filesystem type for the volume. |
iops? | number | The number of I/O operations per second (IOPS). |
kms | IKey | AWS Key Management Service key to use for Amazon EBS encryption. |
role? | IRole | An IAM role that allows ECS to make calls to EBS APIs on your behalf. |
size? | Size | The size of the volume in GiB. |
snap | string | The snapshot that Amazon ECS uses to create the volume. |
tag | EBSTag [] | Specifies the tags to apply to the volume and whether to propagate those tags to the volume. |
throughput? | number | The throughput to provision for a volume, in MiB/s, with a maximum of 1,000 MiB/s. |
volume | Ebs | The volume type. |
encrypted?
Type:
boolean
(optional, default: Default Amazon EBS encryption.)
Indicates whether the volume should be encrypted.
fileSystemType?
Type:
File
(optional, default: 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?
Type:
number
(optional, default: 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?
Type:
IKey
(optional, default: When encryption
is turned on and no kmsKey
is specified,
the default AWS managed key for Amazon EBS volumes is used.)
AWS Key Management Service key to use for Amazon EBS encryption.
role?
Type:
IRole
(optional, default: automatically generated role.)
An IAM role that allows ECS to make calls to EBS APIs on your behalf.
This role is required to create and manage the Amazon EBS volume.
size?
Type:
Size
(optional, default: The snapshot size is used for the volume size if you specify snapshotId
,
otherwise this parameter is required.)
The size of the volume in GiB.
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?
Type:
string
(optional, default: No snapshot.)
The snapshot that Amazon ECS uses to create the volume.
You must specify either size
or snapshotId
.
tagSpecifications?
Type:
EBSTag
[]
(optional, default: No tags are specified.)
Specifies the tags to apply to the volume and whether to propagate those tags to the volume.
throughput?
Type:
number
(optional, default: No throughput.)
The throughput to provision for a volume, in MiB/s, with a maximum of 1,000 MiB/s.
This parameter is only supported for the gp3 volume type.
volumeType?
Type:
Ebs
(optional, default: ec2.EbsDeviceVolumeType.GP2)
The volume type.