Allocate an Amazon EC2 Dedicated Host for use in your account - Amazon Elastic Compute Cloud
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).

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
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, choose Dedicated Hosts and then choose Allocate Dedicated Host.

  3. For Instance family, choose the instance family for the Dedicated Host.

  4. 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 launch m5.xlarge and m5.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 only m5.4xlarge instances onto the Dedicated Host.

  5. For Availability Zone, choose the Availability Zone in which to allocate the Dedicated Host.

  6. 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.

  7. To enable host recovery for the Dedicated Host, for Host recovery, choose Enable. For more information, see Amazon EC2 Dedicated Host recovery.

  8. For Quantity, enter the number of Dedicated Hosts to allocate.

  9. (Optional) Choose Add new tag and enter a tag key and a tag value.

  10. Choose Allocate.

Amazon CLI
To allocate a Dedicated Host

Use the allocate-hosts Amazon CLI command. The following command allocates a Dedicated Host that supports multiple instance types from the m5 instance family in us-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 1

The following command allocates a Dedicated Host that supports untargeted m4.large instance launches in the eu-west-1a Availability Zone, enables host recovery, and applies a tag with a key of purpose and a value of production.

aws ec2 allocate-hosts --instance-type "m4.large" --availability-zone "eu-west-1a" --auto-placement "on" --host-recovery "on" --quantity 1 --tag-specifications 'ResourceType=dedicated-host,Tags=[{Key=purpose,Value=production}]'
PowerShell
To allocate a Dedicated Host

Use the New-EC2Host Amazon Tools for Windows PowerShell command. The following command allocates a Dedicated Host that supports multiple instance types from the m5 instance family in us-east-1a Availability Zone. The host also has host recovery enabled and it has auto-placement disabled.

PS C:\> New-EC2Host -InstanceFamily m5 -AvailabilityZone us-east-1a -AutoPlacement Off -HostRecovery On -Quantity 1

The following commands allocate a Dedicated Host that supports untargeted m4.large instance launches in the eu-west-1a Availability Zone, enable host recovery, and apply a tag with a key of purpose and a value of production.

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.TagSpecification PS 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 -InstanceType m4.large -AvailabilityZone eu-west-1a -AutoPlacement On -HostRecovery On -Quantity 1 -TagSpecification $tagspec