Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Change the placement for an EC2 instance
You can change the placement group for an instance as follows:
-
Add an instance to a placement group
-
Move an instance from one placement group to another
-
Remove an instance from a placement group
Requirement
Before you can change the placement group for an instance, the instance must be in the
stopped
state.
- Console
-
To change the instance placement
-
Open the Amazon EC2 console at
https://console.amazonaws.cn/ec2/.
-
In the navigation pane, choose
Instances.
-
Select the instance.
-
Choose Actions,
Instance settings,
Modify instance placement.
-
For Placement group, do one of the
following:
To add the instance to a placement group, choose
the placement group.
To move the instance from one placement group to another,
choose the placement group.
To remove the instance from the placement group, choose
None.
-
Choose Save.
- Amazon CLI
-
To move an instance to a placement group
Use the following modify-instance-placement command.
aws ec2 modify-instance-placement \
--instance-id i-0123a456700123456
\
--group-name MySpreadGroup
To remove an instance from a placement group
Use the following modify-instance-placement command. When you specify
an empty string for the placement group name, this removes
the instance from its current placement group.
aws ec2 modify-instance-placement \
--instance-id i-0123a456700123456
\
--group-name ""
- PowerShell
-
To move an instance to a placement group
Use the Edit-EC2InstancePlacement cmdlet with the
name of the placement group.
Edit-EC2InstancePlacement `
-InstanceId i-0123a456700123456
`
-GroupName MySpreadGroup
To remove an instance from a placement group
Use the Edit-EC2InstancePlacement cmdlet with an
empty string for the name of the placement group.
Edit-EC2InstancePlacement `
-InstanceId i-0123a456700123456
`
-GroupName ""