Allocate an Amazon EC2 Dedicated Host for use in your account
To begin using a Dedicated Host, you must first allocate it in your account. After you allocate the Dedicated Host, the Dedicated Host capacity is made available in your account immediately and you can start launching instances onto the Dedicated Host.
When you allocate a Dedicated Host in your account, you can choose a configuration that supports either a single instance type, or multiple instance types within the same instance family. The number of instances that you can run on the host depends on the configuration you choose. For more information see Amazon EC2 Dedicated Host instance capacity configurations.
- Console
-
To allocate a Dedicated Host
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Dedicated Hosts and then choose Allocate Dedicated Host.
-
For Instance family, choose the instance family for the Dedicated Host.
-
Specify whether the Dedicated Host supports multiple instance sizes within the selected instance family, or a specific instance type only. Do one of the following.
-
To configure the Dedicated Host to support multiple instance types in the selected instance family, for Support multiple instance types, choose Enable. Enabling this allows you to launch different instance sizes from the same instance family onto the Dedicated Host. For example, if you choose the
m5
instance family and choose this option, you can launchm5.xlarge
andm5.4xlarge
instances onto the Dedicated Host. -
To configure the Dedicated Host to support a single instance type within the selected instance family, clear Support multiple instance types, and then for Instance type, choose the instance type to support. This allows you to launch a single instance type on the Dedicated Host. For example, if you choose this option and specify
m5.4xlarge
as the supported instance type, you can launch onlym5.4xlarge
instances onto the Dedicated Host.
-
-
For Availability Zone, choose the Availability Zone in which to allocate the Dedicated Host.
-
To allow the Dedicated Host to accept untargeted instance launches that match its instance type, for Instance auto-placement, choose Enable. For more information about auto-placement, see Amazon EC2 Dedicated Host auto-placement and host affinity.
-
To enable host recovery for the Dedicated Host, for Host recovery, choose Enable. For more information, see Amazon EC2 Dedicated Host recovery.
-
For Quantity, enter the number of Dedicated Hosts to allocate.
-
(Optional) Choose Add new tag and enter a tag key and a tag value.
-
Choose Allocate.
- AWS CLI
-
To allocate a Dedicated Host
Use the allocate-hosts AWS CLI command. The following command allocates a Dedicated Host that supports multiple instance types from the
m5
instance family inus-east-1a
Availability Zone. The host also has host recovery enabled and it has auto-placement disabled.aws ec2 allocate-hosts --instance-family "
m5
" --availability-zone "us-east-1a
" --auto-placement "off
" --host-recovery "on
" --quantity 1The following command allocates a Dedicated Host that supports untargeted
m4.large
instance launches in theeu-west-1a
Availability Zone, enables host recovery, and applies a tag with a key ofpurpose
and a value ofproduction
.aws ec2 allocate-hosts --instance-type
"m4.large"
--availability-zone"eu-west-1a"
--auto-placement"on"
--host-recovery"on"
--quantity1
--tag-specifications 'ResourceType=dedicated-host
,Tags=[{Key=purpose
,Value=production
}]' - PowerShell
-
To allocate a Dedicated Host
Use the New-EC2Host AWS Tools for Windows PowerShell command. The following command allocates a Dedicated Host that supports multiple instance types from the
m5
instance family inus-east-1a
Availability Zone. The host also has host recovery enabled and it has auto-placement disabled.PS C:\>
New-EC2Host -InstanceFamilym5
-AvailabilityZoneus-east-1a
-AutoPlacementOff
-HostRecoveryOn
-Quantity1
The following commands allocate a Dedicated Host that supports untargeted
m4.large
instance launches in theeu-west-1a
Availability Zone, enable host recovery, and apply a tag with a key ofpurpose
and a value ofproduction
.The
TagSpecification
parameter used to tag a Dedicated Host on creation requires an object that specifies the type of resource to be tagged, the tag key, and the tag value. The following commands create the required object.PS C:\>
$tag = @{ Key="purpose
"; Value="production
" }PS C:\>
$tagspec = new-object Amazon.EC2.Model.TagSpecificationPS C:\>
$tagspec.ResourceType = "dedicated-host
"PS C:\>
$tagspec.Tags.Add($tag)The following command allocates the Dedicated Host and applies the tag specified in the
$tagspec
object.PS C:\>
New-EC2Host -InstanceTypem4.large
-AvailabilityZoneeu-west-1a
-AutoPlacementOn
-HostRecoveryOn
-Quantity1
-TagSpecification$tagspec