Skip to content
v2.277.0

PlacementProperty Struct ​

Specifies the placement of an instance.

Placement is a property of AWS::EC2::LaunchTemplate LaunchTemplateData .

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 placementProperty: ec2.CfnLaunchTemplate.PlacementProperty = {
  affinity: 'affinity',
  availabilityZone: 'availabilityZone',
  groupId: 'groupId',
  groupName: 'groupName',
  hostId: 'hostId',
  hostResourceGroupArn: 'hostResourceGroupArn',
  partitionNumber: 123,
  spreadDomain: 'spreadDomain',
  tenancy: 'tenancy',
};
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

placement_property = ec2.CfnLaunchTemplate.PlacementProperty(
    affinity="affinity",
    availability_zone="availabilityZone",
    group_id="groupId",
    group_name="groupName",
    host_id="hostId",
    host_resource_group_arn="hostResourceGroupArn",
    partition_number=123,
    spread_domain="spreadDomain",
    tenancy="tenancy"
)
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.*;

PlacementProperty placementProperty = PlacementProperty.builder()
        .affinity("affinity")
        .availabilityZone("availabilityZone")
        .groupId("groupId")
        .groupName("groupName")
        .hostId("hostId")
        .hostResourceGroupArn("hostResourceGroupArn")
        .partitionNumber(123)
        .spreadDomain("spreadDomain")
        .tenancy("tenancy")
        .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 placementProperty = new PlacementProperty {
    Affinity = "affinity",
    AvailabilityZone = "availabilityZone",
    GroupId = "groupId",
    GroupName = "groupName",
    HostId = "hostId",
    HostResourceGroupArn = "hostResourceGroupArn",
    PartitionNumber = 123,
    SpreadDomain = "spreadDomain",
    Tenancy = "tenancy"
};
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"

placementProperty := &PlacementProperty{
	Affinity: jsii.String("affinity"),
	AvailabilityZone: jsii.String("availabilityZone"),
	GroupId: jsii.String("groupId"),
	GroupName: jsii.String("groupName"),
	HostId: jsii.String("hostId"),
	HostResourceGroupArn: jsii.String("hostResourceGroupArn"),
	PartitionNumber: jsii.Number(123),
	SpreadDomain: jsii.String("spreadDomain"),
	Tenancy: jsii.String("tenancy"),
}

Properties ​

affinityoptionalstringaffinityoptionalstraffinityoptionalStringAffinityoptionalstringAffinityoptional*string#
The affinity setting for an instance on a Dedicated Host.
availabilityZoneoptionalstringavailability_zoneoptionalstravailabilityZoneoptionalStringAvailabilityZoneoptionalstringAvailabilityZoneoptional*string#
The Availability Zone for the instance.

Either AvailabilityZone or AvailabilityZoneId can be specified, but not both

groupIdoptionalstringgroup_idoptionalstrgroupIdoptionalStringGroupIdoptionalstringGroupIdoptional*string#
The Group Id of a placement group.

You must specify the Placement Group Group Id to launch an instance in a shared placement group.

groupNameoptionalstringgroup_nameoptionalstrgroupNameoptionalStringGroupNameoptionalstringGroupNameoptional*string#
The name of the placement group for the instance.
hostIdoptionalstringhost_idoptionalstrhostIdoptionalStringHostIdoptionalstringHostIdoptional*string#
The ID of the Dedicated Host for the instance.
hostResourceGroupArnoptionalstringhost_resource_group_arnoptionalstrhostResourceGroupArnoptionalStringHostResourceGroupArnoptionalstringHostResourceGroupArnoptional*string#
The ARN of the host resource group in which to launch the instances.

If you specify a host resource group ARN, omit the Tenancy parameter or set it to host .

partitionNumberoptionalnumberpartition_numberoptionalint | floatpartitionNumberoptionalNumberPartitionNumberoptionaldoublePartitionNumberoptional*float64#
The number of the partition the instance should launch in.

Valid only if the placement group strategy is set to partition .

spreadDomainoptionalstringspread_domainoptionalstrspreadDomainoptionalStringSpreadDomainoptionalstringSpreadDomainoptional*string#
Reserved for future use.
tenancyoptionalstringtenancyoptionalstrtenancyoptionalStringTenancyoptionalstringTenancyoptional*string#
The tenancy of the instance.

An instance with a tenancy of dedicated runs on single-tenant hardware.