# ContainerMountPoint

Defines the mount point details for attaching a volume to a container.

Extends: ContainerMountPoint
Extends: BaseMountPoint

- Source: [`aws-ecs/lib/base/service-managed-volume.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/base/service-managed-volume.ts#L203)
- Type last changed: v2.122.0 · 18 Jan 2024

## Example

```ts
declare const cluster: ecs.Cluster;
const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef');

const container = taskDefinition.addContainer('web', {
  image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
  portMappings: [{
    containerPort: 80,
    protocol: ecs.Protocol.TCP,
  }],
});

const volume = new ecs.ServiceManagedVolume(this, 'EBSVolume', {
  name: 'ebs1',
  managedEBSVolume: {
    size: Size.gibibytes(15),
    volumeType: ec2.EbsDeviceVolumeType.GP3,
    fileSystemType: ecs.FileSystemType.XFS,
    tagSpecifications: [{
      tags: {
        purpose: 'production',
      },
      propagateTags: ecs.EbsPropagatedTagSource.SERVICE,
    }],
  },
});

volume.mountIn(container, {
  containerPath: '/var/lib',
  readOnly: false,
});

taskDefinition.addVolume(volume);

const service = new ecs.FargateService(this, 'FargateService', {
  cluster,
  taskDefinition,
  minHealthyPercent: 100,
});

service.addVolume(volume);
```

## Properties

- `containerPath`: string (required) — The path on the container to mount the host volume at.

- `readOnly`: boolean (required) — 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.
