ServiceManagedVolume
- class aws_cdk.aws_ecs.ServiceManagedVolume(scope, id, *, name, managed_ebs_volume=None)
- Bases: - Construct- Represents a service-managed volume and always configured at launch. - 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) - Parameters:
- scope ( - Construct)
- id ( - str)
- 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
 
 - Methods - mount_in(container, *, container_path, read_only)
- Mounts the service managed volume to a specified container at a defined mount point. - Parameters:
- container ( - ContainerDefinition) – The container to mount the volume on.
- container_path ( - str) – The path on the container to mount the host volume at.
- read_only ( - bool) – Specifies whether to give the container read-only access to the volume. If this value is true, the container has read-only access to the volume. If this value is false, then the container can write to the volume.
 
- Return type:
- None
 
 - to_string()
- Returns a string representation of this construct. - Return type:
- str
 
 - Attributes - config
- Volume configuration. 
 - configured_at_launch
- configuredAtLaunch indicates volume at launch time, referenced by taskdefinition volume. 
 - name
- Name of the volume, referenced by taskdefintion and mount point. 
 - node
- The tree node. 
 - role
- An IAM role that allows ECS to make calls to EBS APIs. - If not provided, a new role with appropriate permissions will be created by default. 
 - Static Methods - classmethod is_construct(x)
- Checks if - xis a construct.- Use this method instead of - instanceofto properly detect- Constructinstances, even when the construct library is symlinked.- Explanation: in JavaScript, multiple copies of the - constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the class- Constructin each copy of the- constructslibrary is seen as a different class, and an instance of one class will not test as- instanceofthe other class.- npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the- constructslibrary can be accidentally installed, and- instanceofwill behave unpredictably. It is safest to avoid using- instanceof, and using this type-testing method instead.- Parameters:
- x ( - Any) – Any object.
- Return type:
- bool
- Returns:
- true if - xis an object created from a class which extends- Construct.