# ResourceRequirementProperty

The type and amount of a resource to assign to a container.

The supported resource types are GPUs and Elastic Inference accelerators. For more information, see [Working with GPUs on Amazon ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-gpu.html) or [Working with Amazon Elastic Inference on Amazon ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-inference.html) in the *Amazon Elastic Container Service Developer Guide*

- Source: Generated at build time
- Type last changed: v2.276.0 · 10 Nov 2026

## 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 resourceRequirementProperty: ecs.CfnTaskDefinition.ResourceRequirementProperty = {
  type: 'type',

  // the properties below are optional
  sharingStrategy: {
    nvidiaMps: {
      memory: 123,

      // the properties below are optional
      maxComputePercent: 123,
    },
  },
  value: 'value',
};
```

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

resource_requirement_property = ecs.CfnTaskDefinition.ResourceRequirementProperty(
    type="type",

    # the properties below are optional
    sharing_strategy=ecs.CfnTaskDefinition.SharingStrategyProperty(
        nvidia_mps=ecs.CfnTaskDefinition.NvidiaMpsAllocationProperty(
            memory=123,

            # the properties below are optional
            max_compute_percent=123
        )
    ),
    value="value"
)
```

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.*;

ResourceRequirementProperty resourceRequirementProperty = ResourceRequirementProperty.builder()
        .type("type")

        // the properties below are optional
        .sharingStrategy(SharingStrategyProperty.builder()
                .nvidiaMps(NvidiaMpsAllocationProperty.builder()
                        .memory(123)

                        // the properties below are optional
                        .maxComputePercent(123)
                        .build())
                .build())
        .value("value")
        .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 resourceRequirementProperty = new ResourceRequirementProperty {
    Type = "type",

    // the properties below are optional
    SharingStrategy = new SharingStrategyProperty {
        NvidiaMps = new NvidiaMpsAllocationProperty {
            Memory = 123,

            // the properties below are optional
            MaxComputePercent = 123
        }
    },
    Value = "value"
};
```

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"

resourceRequirementProperty := &ResourceRequirementProperty{
	Type: jsii.String("type"),

	// the properties below are optional
	SharingStrategy: &SharingStrategyProperty{
		NvidiaMps: &NvidiaMpsAllocationProperty{
			Memory: jsii.Number(123),

			// the properties below are optional
			MaxComputePercent: jsii.Number(123),
		},
	},
	Value: jsii.String("value"),
}
```

## Properties

- `sharingStrategy`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnTaskDefinition.SharingStrategyProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnTaskDefinition.SharingStrategyProperty.html)

- `type`: string (required) — The type of resource to assign to a container.

- `value`: string — The value for the specified resource type.

  When the type is `GPU` , the value is the number of physical `GPUs` the Amazon ECS container agent reserves for the container. The number of GPUs that's reserved for all containers in a task can't exceed the number of available GPUs on the container instance that the task is launched on.

  When the type is `InferenceAccelerator` , the `value` matches the `deviceName` for an [InferenceAccelerator](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_InferenceAccelerator.html) specified in a task definition.
