Skip to main content

hosts

Creates, updates, deletes or gets a host resource or lists hosts in a region

Overview

Namehosts
TypeResource
DescriptionResource Type definition for AWS::EC2::Host
Idawscc.ec2.hosts

Fields

NameDatatypeDescription
host_idstringID of the host created.
auto_placementstringIndicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID.
availability_zonestringThe Availability Zone in which to allocate the Dedicated Host.
host_recoverystringIndicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default.
instance_typestringSpecifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the Dedicated Hosts support instances of the specified instance type only.
instance_familystringSpecifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the Dedicated Hosts support multiple instance types within that instance family.
outpost_arnstringThe Amazon Resource Name (ARN) of the Amazon Web Services Outpost on which to allocate the Dedicated Host.
host_maintenancestringAutomatically allocates a new dedicated host and moves your instances on to it if a degradation is detected on your current host.
asset_idstringThe ID of the Outpost hardware asset.
tagsarrayAny tags assigned to the Host.
regionstringAWS region.

For more information, see AWS::EC2::Host.

Methods

NameResourceAccessible byRequired Params
create_resourcehostsINSERTAvailabilityZone, region
delete_resourcehostsDELETEIdentifier, region
update_resourcehostsUPDATEIdentifier, PatchDocument, region
list_resourceshosts_list_onlySELECTregion
get_resourcehostsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual host.

SELECT
region,
host_id,
auto_placement,
availability_zone,
host_recovery,
instance_type,
instance_family,
outpost_arn,
host_maintenance,
asset_id,
tags
FROM awscc.ec2.hosts
WHERE
region = 'us-east-1' AND
Identifier = '{{ host_id }}';

INSERT example

Use the following StackQL query and manifest file to create a new host resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.ec2.hosts (
AvailabilityZone,
region
)
SELECT
'{{ availability_zone }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a host resource, using stack-deploy.

/*+ update */
UPDATE awscc.ec2.hosts
SET PatchDocument = string('{{ {
"AutoPlacement": auto_placement,
"HostRecovery": host_recovery,
"HostMaintenance": host_maintenance,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ host_id }}';

DELETE example

/*+ delete */
DELETE FROM awscc.ec2.hosts
WHERE
Identifier = '{{ host_id }}' AND
region = 'us-east-1';

Permissions

To operate on the hosts resource, the following permissions are required:

ec2:AllocateHosts,
ec2:DescribeHosts,
ec2:CreateTags