# PidMode

The process namespace to use for the containers in the task.

- Source: [`aws-ecs/lib/base/task-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts#L1097)

## Example

TypeScript:

```ts
const fargateTaskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef', {
  runtimePlatform: {
    operatingSystemFamily: ecs.OperatingSystemFamily.LINUX,
    cpuArchitecture: ecs.CpuArchitecture.ARM64,
  },
  memoryLimitMiB: 512,
  cpu: 256,
  pidMode: ecs.PidMode.TASK,
});
```

Python:

```python
fargate_task_definition = ecs.FargateTaskDefinition(self, "TaskDef",
    runtime_platform=ecs.RuntimePlatform(
        operating_system_family=ecs.OperatingSystemFamily.LINUX,
        cpu_architecture=ecs.CpuArchitecture.ARM64
    ),
    memory_limit_mi_b=512,
    cpu=256,
    pid_mode=ecs.PidMode.TASK
)
```

Java:

```java
FargateTaskDefinition fargateTaskDefinition = FargateTaskDefinition.Builder.create(this, "TaskDef")
        .runtimePlatform(RuntimePlatform.builder()
                .operatingSystemFamily(OperatingSystemFamily.LINUX)
                .cpuArchitecture(CpuArchitecture.ARM64)
                .build())
        .memoryLimitMiB(512)
        .cpu(256)
        .pidMode(PidMode.TASK)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var fargateTaskDefinition = new FargateTaskDefinition(this, "TaskDef", new FargateTaskDefinitionProps {
    RuntimePlatform = new RuntimePlatform {
        OperatingSystemFamily = OperatingSystemFamily.LINUX,
        CpuArchitecture = CpuArchitecture.ARM64
    },
    MemoryLimitMiB = 512,
    Cpu = 256,
    PidMode = PidMode.TASK
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
fargateTaskDefinition := ecs.NewFargateTaskDefinition(this, jsii.String("TaskDef"), &FargateTaskDefinitionProps{
	RuntimePlatform: &RuntimePlatform{
		OperatingSystemFamily: ecs.OperatingSystemFamily_LINUX(),
		CpuArchitecture: ecs.CpuArchitecture_ARM64(),
	},
	MemoryLimitMiB: jsii.Number(512),
	Cpu: jsii.Number(256),
	PidMode: ecs.PidMode_TASK,
})
```

## Members

| Member | Description |
| --- | --- |
| `HOST` | If host is specified, then all containers within the tasks that specified the host PID mode on the same container instance share the same process namespace with the host Amazon EC2 instance. |
| `TASK` | If task is specified, all containers within the specified task share the same process namespace. |

## Referenced by

- [`Ec2TaskDefinitionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Ec2TaskDefinitionProps.html).pidMode
- [`FargateTaskDefinitionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.FargateTaskDefinitionProps.html).pidMode
- [`TaskDefinition`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.TaskDefinition.html).pidMode
- [`TaskDefinitionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.TaskDefinitionProps.html).pidMode
