Skip to content
v2.278.0

TargetCapacitySpecificationRequestProperty Struct ​

Specifies the number of units to request for an EC2 Fleet.

You can choose to set the target capacity in terms of instances or a performance characteristic that is important to your application workload, such as vCPUs, memory, or I/O. If the request type is maintain , you can specify a target capacity of 0 and add capacity later.

TargetCapacitySpecificationRequest is a property of the AWS::EC2::EC2Fleet resource.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const targetCapacitySpecificationRequestProperty: ec2.CfnEC2Fleet.TargetCapacitySpecificationRequestProperty = {
  totalTargetCapacity: 123,

  // the properties below are optional
  defaultTargetCapacityType: 'defaultTargetCapacityType',
  onDemandTargetCapacity: 123,
  spotTargetCapacity: 123,
  targetCapacityUnitType: 'targetCapacityUnitType',
};
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_ec2 as ec2

target_capacity_specification_request_property = ec2.CfnEC2Fleet.TargetCapacitySpecificationRequestProperty(
    total_target_capacity=123,

    # the properties below are optional
    default_target_capacity_type="defaultTargetCapacityType",
    on_demand_target_capacity=123,
    spot_target_capacity=123,
    target_capacity_unit_type="targetCapacityUnitType"
)
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.ec2.*;

TargetCapacitySpecificationRequestProperty targetCapacitySpecificationRequestProperty = TargetCapacitySpecificationRequestProperty.builder()
        .totalTargetCapacity(123)

        // the properties below are optional
        .defaultTargetCapacityType("defaultTargetCapacityType")
        .onDemandTargetCapacity(123)
        .spotTargetCapacity(123)
        .targetCapacityUnitType("targetCapacityUnitType")
        .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.EC2;

var targetCapacitySpecificationRequestProperty = new TargetCapacitySpecificationRequestProperty {
    TotalTargetCapacity = 123,

    // the properties below are optional
    DefaultTargetCapacityType = "defaultTargetCapacityType",
    OnDemandTargetCapacity = 123,
    SpotTargetCapacity = 123,
    TargetCapacityUnitType = "targetCapacityUnitType"
};
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"

targetCapacitySpecificationRequestProperty := &TargetCapacitySpecificationRequestProperty{
	TotalTargetCapacity: jsii.Number(123),

	// the properties below are optional
	DefaultTargetCapacityType: jsii.String("defaultTargetCapacityType"),
	OnDemandTargetCapacity: jsii.Number(123),
	SpotTargetCapacity: jsii.Number(123),
	TargetCapacityUnitType: jsii.String("targetCapacityUnitType"),
}

Properties ​

defaultTargetCapacityTypeoptionalstringdefault_target_capacity_typeoptionalstrdefaultTargetCapacityTypeoptionalStringDefaultTargetCapacityTypeoptionalstringDefaultTargetCapacityTypeoptional*string #
The default target capacity type.
onDemandTargetCapacityoptionalnumberon_demand_target_capacityoptionalint | floatonDemandTargetCapacityoptionalNumberOnDemandTargetCapacityoptionaldoubleOnDemandTargetCapacityoptional*float64 #
The number of On-Demand units to request.
spotTargetCapacityoptionalnumberspot_target_capacityoptionalint | floatspotTargetCapacityoptionalNumberSpotTargetCapacityoptionaldoubleSpotTargetCapacityoptional*float64 #
The number of Spot units to request.
targetCapacityUnitTypeoptionalstringtarget_capacity_unit_typeoptionalstrtargetCapacityUnitTypeoptionalStringTargetCapacityUnitTypeoptionalstringTargetCapacityUnitTypeoptional*string #
The unit for the target capacity. You can specify this parameter only when using attributed-based instance type selection.

Default: units (the number of instances)

totalTargetCapacitynumbertotal_target_capacityint | floattotalTargetCapacityNumberTotalTargetCapacitydoubleTotalTargetCapacity*float64 required #
The number of units to request, filled using the default target capacity type.