modify_instance_placement
¶
modify_instance_placement(
*,
config_overrides: Optional[EC2ClientConfig] = 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/ec2.py
50861 50862 50863 50864 50865 50866 50867 50868 50869 50870 50871 50872 50873 50874 50875 50876 50877 50878 50879 50880 50881 50882 50883 50884 50885 50886 50887 50888 50889 50890 50891 50892 50893 50894 50895 50896 50897 50898 50899 50900 50901 50902 50903 50904 50905 50906 50907 50908 50909 50910 50911 50912 50913 50914 50915 50916 50917 50918 50919 50920 50921 50922 50923 50924 50925 50926 50927 50928 50929 50930 50931 50932 50933 50934 50935 | |