Class ServiceManagedVolume

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.ecs.ServiceManagedVolume
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-25T14:21:14.694Z") @Stability(Stable) public class ServiceManagedVolume extends software.constructs.Construct
Represents a service-managed volume and always configured at launch.

Example:

 Cluster cluster;
 FargateTaskDefinition taskDefinition = new FargateTaskDefinition(this, "TaskDef");
 ContainerDefinition container = taskDefinition.addContainer("web", ContainerDefinitionOptions.builder()
         .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
         .portMappings(List.of(PortMapping.builder()
                 .containerPort(80)
                 .protocol(Protocol.TCP)
                 .build()))
         .build());
 ServiceManagedVolume volume = ServiceManagedVolume.Builder.create(this, "EBSVolume")
         .name("ebs1")
         .managedEBSVolume(ServiceManagedEBSVolumeConfiguration.builder()
                 .size(Size.gibibytes(15))
                 .volumeType(EbsDeviceVolumeType.GP3)
                 .fileSystemType(FileSystemType.XFS)
                 .tagSpecifications(List.of(EBSTagSpecification.builder()
                         .tags(Map.of(
                                 "purpose", "production"))
                         .propagateTags(EbsPropagatedTagSource.SERVICE)
                         .build()))
                 .build())
         .build();
 volume.mountIn(container, ContainerMountPoint.builder()
         .containerPath("/var/lib")
         .readOnly(false)
         .build());
 taskDefinition.addVolume(volume);
 FargateService service = FargateService.Builder.create(this, "FargateService")
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .build();
 service.addVolume(volume);
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for ServiceManagedVolume.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.constructs.IConstruct

    software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ServiceManagedVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    ServiceManagedVolume(software.amazon.jsii.JsiiObjectRef objRef)
     
     
    ServiceManagedVolume(software.constructs.Construct scope, String id, ServiceManagedVolumeProps props)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Volume configuration.
    configuredAtLaunch indicates volume at launch time, referenced by taskdefinition volume.
    Name of the volume, referenced by taskdefintion and mount point.
    An IAM role that allows ECS to make calls to EBS APIs.
    void
    Mounts the service managed volume to a specified container at a defined mount point.

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, toString

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • ServiceManagedVolume

      protected ServiceManagedVolume(software.amazon.jsii.JsiiObjectRef objRef)
    • ServiceManagedVolume

      protected ServiceManagedVolume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ServiceManagedVolume

      @Stability(Stable) public ServiceManagedVolume(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ServiceManagedVolumeProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • mountIn

      @Stability(Stable) public void mountIn(@NotNull ContainerDefinition container, @NotNull ContainerMountPoint mountPoint)
      Mounts the service managed volume to a specified container at a defined mount point.

      Parameters:
      container - The container to mount the volume on. This parameter is required.
      mountPoint - The mounting point details within the container. This parameter is required.
    • getConfiguredAtLaunch

      @Stability(Stable) @NotNull public Boolean getConfiguredAtLaunch()
      configuredAtLaunch indicates volume at launch time, referenced by taskdefinition volume.
    • getName

      @Stability(Stable) @NotNull public String getName()
      Name of the volume, referenced by taskdefintion and mount point.
    • getRole

      @Stability(Stable) @NotNull public IRole getRole()
      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.

    • getConfig

      @Stability(Stable) @Nullable public ServiceManagedEBSVolumeConfiguration getConfig()
      Volume configuration.