ServiceManagedVolumeProps
- class aws_cdk.aws_ecs.ServiceManagedVolumeProps(*, name, managed_ebs_volume=None)
Bases:
object
Represents the Volume configuration for an ECS service.
- Parameters:
name (
str
) – The name of the volume. This corresponds to the name provided in the ECS TaskDefinition.managed_ebs_volume (
Union
[ServiceManagedEBSVolumeConfiguration
,Dict
[str
,Any
],None
]) – Configuration for an Amazon Elastic Block Store (EBS) volume managed by ECS. Default: - undefined
- 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, min_healthy_percent=100 ) service.add_volume(volume)
Attributes
- managed_ebs_volume
Configuration for an Amazon Elastic Block Store (EBS) volume managed by ECS.
- Default:
undefined
- name
The name of the volume.
This corresponds to the name provided in the ECS TaskDefinition.