hosts
Creates, updates, deletes or gets a host resource or lists hosts in a region
Overview
| Name | hosts |
| Type | Resource |
| Description | Resource Type definition for AWS::EC2::Host |
| Id | awscc.ec2.hosts |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
host_id | string | ID of the host created. |
auto_placement | string | Indicates 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_zone | string | The Availability Zone in which to allocate the Dedicated Host. |
host_recovery | string | Indicates whether to enable or disable host recovery for the Dedicated Host. Host recovery is disabled by default. |
instance_type | string | Specifies 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_family | string | Specifies 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_arn | string | The Amazon Resource Name (ARN) of the Amazon Web Services Outpost on which to allocate the Dedicated Host. |
host_maintenance | string | Automatically allocates a new dedicated host and moves your instances on to it if a degradation is detected on your current host. |
asset_id | string | The ID of the Outpost hardware asset. |
tags | array | Any tags assigned to the Host. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
host_id | string | ID of the host created. |
region | string | AWS region. |
For more information, see AWS::EC2::Host.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | hosts | INSERT | AvailabilityZone, region |
delete_resource | hosts | DELETE | Identifier, region |
update_resource | hosts | UPDATE | Identifier, PatchDocument, region |
list_resources | hosts_list_only | SELECT | region |
get_resource | hosts | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = '{{ region }}' AND
Identifier = '{{ host_id }}';
Lists all hosts in a region.
SELECT
region,
host_id
FROM awscc.ec2.hosts_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new host resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.hosts (
AvailabilityZone,
region
)
SELECT
'{{ availability_zone }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.ec2.hosts (
AutoPlacement,
AvailabilityZone,
HostRecovery,
InstanceType,
InstanceFamily,
OutpostArn,
HostMaintenance,
AssetId,
Tags,
region
)
SELECT
'{{ auto_placement }}',
'{{ availability_zone }}',
'{{ host_recovery }}',
'{{ instance_type }}',
'{{ instance_family }}',
'{{ outpost_arn }}',
'{{ host_maintenance }}',
'{{ asset_id }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: host
props:
- name: auto_placement
value: '{{ auto_placement }}'
- name: availability_zone
value: '{{ availability_zone }}'
- name: host_recovery
value: '{{ host_recovery }}'
- name: instance_type
value: '{{ instance_type }}'
- name: instance_family
value: '{{ instance_family }}'
- name: outpost_arn
value: '{{ outpost_arn }}'
- name: host_maintenance
value: '{{ host_maintenance }}'
- name: asset_id
value: '{{ asset_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.hosts
WHERE
Identifier = '{{ host_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the hosts resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
ec2:AllocateHosts,
ec2:DescribeHosts,
ec2:CreateTags
ec2:DescribeHosts
ec2:ModifyHosts,
ec2:DescribeHosts,
ec2:DeleteTags,
ec2:CreateTags
ec2:ReleaseHosts,
ec2:DescribeHosts
ec2:DescribeHosts