# PlacementProperty

Specifies the placement of an instance.

`Placement` is a property of [AWS::EC2::LaunchTemplate LaunchTemplateData](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html) .

- 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_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:

```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:

```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();
```

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

var placementProperty = new PlacementProperty {
    Affinity = "affinity",
    AvailabilityZone = "availabilityZone",
    GroupId = "groupId",
    GroupName = "groupName",
    HostId = "hostId",
    HostResourceGroupArn = "hostResourceGroupArn",
    PartitionNumber = 123,
    SpreadDomain = "spreadDomain",
    Tenancy = "tenancy"
};
```

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"

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

- `affinity`: string — The affinity setting for an instance on a Dedicated Host.

- `availabilityZone`: string — The Availability Zone for the instance.

  Either `AvailabilityZone` or `AvailabilityZoneId` can be specified, but not both

- `groupId`: 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.

- `groupName`: string — The name of the placement group for the instance.

- `hostId`: string — The ID of the Dedicated Host for the instance.

- `hostResourceGroupArn`: 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` .

- `partitionNumber`: number — The number of the partition the instance should launch in.

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

- `spreadDomain`: string — Reserved for future use.

- `tenancy`: string — The tenancy of the instance.

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