EbsPropagatedTagSource

class aws_cdk.aws_ecs.EbsPropagatedTagSource(value)

Bases: Enum

Propagate tags for EBS Volume Configuration from either service or task definition.

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

SERVICE

SERVICE.

TASK_DEFINITION

TASK_DEFINITION.