Class ServiceManagedVolumeProps
Represents the Volume configuration for an ECS service.
Inheritance
System.Object
ServiceManagedVolumeProps
Implements
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ServiceManagedVolumeProps : Object, IServiceManagedVolumeProps
Syntax (vb)
Public Class ServiceManagedVolumeProps
Inherits Object
Implements IServiceManagedVolumeProps
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
ServiceManagedVolumeProps() |
Properties
ManagedEBSVolume | Configuration for an Amazon Elastic Block Store (EBS) volume managed by ECS. |
Name | The name of the volume. |
Constructors
ServiceManagedVolumeProps()
public ServiceManagedVolumeProps()
Properties
ManagedEBSVolume
Configuration for an Amazon Elastic Block Store (EBS) volume managed by ECS.
public IServiceManagedEBSVolumeConfiguration ManagedEBSVolume { get; set; }
Property Value
IServiceManagedEBSVolumeConfiguration
Remarks
Default: - undefined
Name
The name of the volume.
public string Name { get; set; }
Property Value
System.String
Remarks
This corresponds to the name provided in the ECS TaskDefinition.