ResourceRequirementProperty Struct
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 or Working with Amazon Elastic Inference on Amazon ECS in the Amazon Elastic Container Service Developer Guide
| Source | |
|---|---|
| Type last changed |
Example
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
# 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
// 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();
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"
};
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
sharingStrategyoptionalIResolvable | CfnTaskDefinition.sharing_strategyoptionaltyping.Union[IResolvable, SharingStrategyProperty]sharingStrategyoptionalIResolvableSharingStrategyoptionalIResolvableSharingStrategyoptionalinterface{} #The type of resource to assign to a container.
The value for the specified resource type.
notes
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 specified in a task definition.