Class ServiceManagedVolume
Represents a service-managed volume and always configured at launch.
Inheritance
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ServiceManagedVolume : Construct
Syntax (vb)
Public Class ServiceManagedVolume
Inherits Construct
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
var taskDefinition = new FargateTaskDefinition(this, "TaskDef");
var container = taskDefinition.AddContainer("web", new ContainerDefinitionOptions {
Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
PortMappings = new [] { new PortMapping {
ContainerPort = 80,
Protocol = Protocol.TCP
} }
});
var volume = new ServiceManagedVolume(this, "EBSVolume", new ServiceManagedVolumeProps {
Name = "ebs1",
ManagedEBSVolume = new ServiceManagedEBSVolumeConfiguration {
Size = Size.Gibibytes(15),
VolumeType = EbsDeviceVolumeType.GP3,
FileSystemType = FileSystemType.XFS,
TagSpecifications = new [] { new EBSTagSpecification {
Tags = new Dictionary<string, string> {
{ "purpose", "production" }
},
PropagateTags = EbsPropagatedTagSource.SERVICE
} }
}
});
volume.MountIn(container, new ContainerMountPoint {
ContainerPath = "/var/lib",
ReadOnly = false
});
taskDefinition.AddVolume(volume);
var service = new FargateService(this, "FargateService", new FargateServiceProps {
Cluster = cluster,
TaskDefinition = taskDefinition
});
service.AddVolume(volume);
Synopsis
Constructors
ServiceManagedVolume(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ServiceManagedVolume(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
ServiceManagedVolume(Construct, String, IServiceManagedVolumeProps) |
Properties
Config | Volume configuration. |
ConfiguredAtLaunch | configuredAtLaunch indicates volume at launch time, referenced by taskdefinition volume. |
Name | Name of the volume, referenced by taskdefintion and mount point. |
Role | An IAM role that allows ECS to make calls to EBS APIs. |
Methods
MountIn(ContainerDefinition, IContainerMountPoint) | Mounts the service managed volume to a specified container at a defined mount point. |
Constructors
ServiceManagedVolume(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ServiceManagedVolume(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ServiceManagedVolume(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ServiceManagedVolume(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
ServiceManagedVolume(Construct, String, IServiceManagedVolumeProps)
public ServiceManagedVolume(Construct scope, string id, IServiceManagedVolumeProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IServiceManagedVolumeProps
Properties
Config
Volume configuration.
public virtual IServiceManagedEBSVolumeConfiguration Config { get; }
Property Value
IServiceManagedEBSVolumeConfiguration
ConfiguredAtLaunch
configuredAtLaunch indicates volume at launch time, referenced by taskdefinition volume.
public virtual bool ConfiguredAtLaunch { get; }
Property Value
System.Boolean
Name
Name of the volume, referenced by taskdefintion and mount point.
public virtual string Name { get; }
Property Value
System.String
Role
An IAM role that allows ECS to make calls to EBS APIs.
public virtual IRole Role { get; }
Property Value
Remarks
If not provided, a new role with appropriate permissions will be created by default.
Methods
MountIn(ContainerDefinition, IContainerMountPoint)
Mounts the service managed volume to a specified container at a defined mount point.
public virtual void MountIn(ContainerDefinition container, IContainerMountPoint mountPoint)
Parameters
- container ContainerDefinition
The container to mount the volume on.
- mountPoint IContainerMountPoint
The mounting point details within the container.