ServiceManagedEBSVolumeConfiguration
- class aws_cdk.aws_ecs.ServiceManagedEBSVolumeConfiguration(*, encrypted=None, file_system_type=None, iops=None, kms_key_id=None, role=None, size=None, snap_shot_id=None, tag_specifications=None, throughput=None, volume_type=None)
Bases:
object
Represents the configuration for an ECS Service managed EBS volume.
- Parameters:
encrypted (
Optional
[bool
]) – Indicates whether the volume should be encrypted. Default: - Default Amazon EBS encryption.file_system_type (
Optional
[FileSystemType
]) – 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. Default: - FileSystemType.XFSiops (
Union
[int
,float
,None
]) – 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. Default: - undefinedkms_key_id (
Optional
[IKey
]) – AWS Key Management Service key to use for Amazon EBS encryption. Default: - Whenencryption
is turned on and nokmsKey
is specified, the default AWS managed key for Amazon EBS volumes is used.role (
Optional
[IRole
]) – 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. Default: - automatically generated role.size (
Optional
[Size
]) – The size of the volume in GiB. You must specify eithersize
orsnapshotId
. 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: - The snapshot size is used for the volume size if you specifysnapshotId
, otherwise this parameter is required.snap_shot_id (
Optional
[str
]) – The snapshot that Amazon ECS uses to create the volume. You must specify eithersize
orsnapshotId
. Default: - No snapshot.tag_specifications (
Optional
[Sequence
[Union
[EBSTagSpecification
,Dict
[str
,Any
]]]]) – Specifies the tags to apply to the volume and whether to propagate those tags to the volume. Default: - No tags are specified.throughput (
Union
[int
,float
,None
]) – 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. Default: - No throughput.volume_type (
Optional
[EbsDeviceVolumeType
]) – The volume type. Default: - ec2.EbsDeviceVolumeType.GP2
- ExampleMetadata:
infused
Example:
# cluster: ecs.Cluster task_definition = ecs.FargateTaskDefinition(self, "TaskDef") container = task_definition.add_container("web", image=ecs.ContainerImage.from_registry("amazon/amazon-ecs-sample"), port_mappings=[ecs.PortMapping( container_port=80, protocol=ecs.Protocol.TCP )] ) volume = ecs.ServiceManagedVolume(self, "EBSVolume", name="ebs1", managed_eBSVolume=ecs.ServiceManagedEBSVolumeConfiguration( size=Size.gibibytes(15), volume_type=ec2.EbsDeviceVolumeType.GP3, file_system_type=ecs.FileSystemType.XFS, tag_specifications=[ecs.EBSTagSpecification( tags={ "purpose": "production" }, propagate_tags=ecs.EbsPropagatedTagSource.SERVICE )] ) ) volume.mount_in(container, container_path="/var/lib", read_only=False ) task_definition.add_volume(volume) service = ecs.FargateService(self, "FargateService", cluster=cluster, task_definition=task_definition ) service.add_volume(volume)
Attributes
- encrypted
Indicates whether the volume should be encrypted.
- Default:
Default Amazon EBS encryption.
- file_system_type
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.
- Default:
FileSystemType.XFS
- iops
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.
- Default:
undefined
- kms_key_id
AWS Key Management Service key to use for Amazon EBS encryption.
- Default:
When
encryption
is turned on and nokmsKey
is specified,
the default AWS managed key for Amazon EBS volumes is used.
- 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.
- Default:
automatically generated role.
- size
The size of the volume in GiB.
You must specify either
size
orsnapshotId
. 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:
The snapshot size is used for the volume size if you specify
snapshotId
,
otherwise this parameter is required.
- snap_shot_id
The snapshot that Amazon ECS uses to create the volume.
You must specify either
size
orsnapshotId
.- Default:
No snapshot.
- tag_specifications
Specifies the tags to apply to the volume and whether to propagate those tags to the volume.
- Default:
No tags are specified.
- 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.
- Default:
No throughput.
- volume_type
The volume type.
- Default:
ec2.EbsDeviceVolumeType.GP2