# TaskDefinitionPlacementConstraintProperty

The constraint on task placement in the task definition.

For more information, see [Task placement constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html) in the *Amazon Elastic Container Service Developer Guide* .

> Task placement constraints aren't supported for tasks run on AWS Fargate .

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const taskDefinitionPlacementConstraintProperty: ecs.CfnTaskDefinition.TaskDefinitionPlacementConstraintProperty = {
  type: 'type',

  // the properties below are optional
  expression: 'expression',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs

task_definition_placement_constraint_property = ecs.CfnTaskDefinition.TaskDefinitionPlacementConstraintProperty(
    type="type",

    # the properties below are optional
    expression="expression"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;

TaskDefinitionPlacementConstraintProperty taskDefinitionPlacementConstraintProperty = TaskDefinitionPlacementConstraintProperty.builder()
        .type("type")

        // the properties below are optional
        .expression("expression")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;

var taskDefinitionPlacementConstraintProperty = new TaskDefinitionPlacementConstraintProperty {
    Type = "type",

    // the properties below are optional
    Expression = "expression"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

taskDefinitionPlacementConstraintProperty := &TaskDefinitionPlacementConstraintProperty{
	Type: jsii.String("type"),

	// the properties below are optional
	Expression: jsii.String("expression"),
}
```

## Properties

- `expression`: string — A cluster query language expression to apply to the constraint.

  For more information, see [Cluster query language](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html) in the *Amazon Elastic Container Service Developer Guide* .

- `type`: string (required) — The type of constraint.

  The `MemberOf` constraint restricts selection to be from a group of valid candidates.
