modify_instance_placement
async
¶
modify_instance_placement(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
group_name: Optional[PlacementGroupName] = None,
partition_number: Optional[Integer] = None,
host_resource_group_arn: Optional[String] = None,
group_id: Optional[PlacementGroupId] = None,
instance_id: Optional[InstanceId] = None,
tenancy: Optional[HostTenancy] = None,
affinity: Optional[Affinity] = None,
host_id: Optional[DedicatedHostId] = None,
) -> ModifyInstancePlacementResult
Modifies the placement attributes for a specified instance. You can do the following:
-
Modify the affinity between an instance and a Dedicated Host. When affinity is set to
hostand the instance is not associated with a specific Dedicated Host, the next time the instance is started, it is automatically associated with the host on which it lands. If the instance is restarted or rebooted, this relationship persists. -
Change the Dedicated Host with which an instance is associated.
-
Change the instance tenancy of an instance.
-
Move an instance to or from a placement group.
At least one attribute for affinity, host ID, tenancy, or placement group name must be specified in the request. Affinity and tenancy can be modified in the same request.
To modify the host ID, tenancy, placement group, or partition for an instance, the instance must be in the stopped state.
Parameters:
-
group_name(Optional[PlacementGroupName], default:None) –The name of the placement group in which to place the instance. For spread placement groups, the instance must have a tenancy of
default. For cluster and partition placement groups, the instance must have a tenancy ofdefaultordedicated.To remove an instance from a placement group, specify an empty string ("").
-
partition_number(Optional[Integer], default:None) –The number of the partition in which to place the instance. Valid only if the placement group strategy is set to
partition. -
host_resource_group_arn(Optional[String], default:None) –The ARN of the host resource group in which to place the instance. The instance must have a tenancy of
hostto specify this parameter. -
group_id(Optional[PlacementGroupId], default:None) –The Group Id of a placement group. You must specify the Placement Group Group Id to launch an instance in a shared placement group.
-
instance_id(Optional[InstanceId], default:None) –The ID of the instance that you are modifying.
-
tenancy(Optional[HostTenancy], default:None) –The tenancy for the instance.
For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of
host. You can't change the tenancy fromhosttodedicatedordefault. Attempting to make one of these unsupported tenancy changes results in anInvalidRequesterror code. -
affinity(Optional[Affinity], default:None) –The affinity setting for the instance. For more information, see Host affinity in the Amazon EC2 User Guide.
-
host_id(Optional[DedicatedHostId], default:None) –The ID of the Dedicated Host with which to associate the instance.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ec2/_services/async_ec2.py
51567 51568 51569 51570 51571 51572 51573 51574 51575 51576 51577 51578 51579 51580 51581 51582 51583 51584 51585 51586 51587 51588 51589 51590 51591 51592 51593 51594 51595 51596 51597 51598 51599 51600 51601 51602 51603 51604 51605 51606 51607 51608 51609 51610 51611 51612 51613 51614 51615 51616 51617 51618 51619 51620 51621 51622 51623 51624 51625 51626 51627 51628 51629 51630 51631 51632 51633 51634 51635 51636 51637 51638 51639 51640 51641 51642 | |