ec2fleets
Creates, updates, deletes or gets an ec2fleet resource or lists ec2fleets in a region
Overview
| Name | ec2fleets |
| Type | Resource |
| Description | Resource Type definition for AWS::EC2::EC2Fleet |
| Id | awscc.ec2.ec2fleets |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
target_capacity_specification | object | |
on_demand_options | object | |
type | string | |
excess_capacity_termination_policy | string | |
tag_specifications | array | |
spot_options | object | |
valid_from | string | |
replace_unhealthy_instances | boolean | |
launch_template_configs | array | |
fleet_id | string | |
terminate_instances_with_expiration | boolean | |
valid_until | string | |
context | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
fleet_id | string | |
region | string | AWS region. |
For more information, see AWS::EC2::EC2Fleet.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | ec2fleets | INSERT | TargetCapacitySpecification, LaunchTemplateConfigs, region |
delete_resource | ec2fleets | DELETE | Identifier, region |
update_resource | ec2fleets | UPDATE | Identifier, PatchDocument, region |
list_resources | ec2fleets_list_only | SELECT | region |
get_resource | ec2fleets | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual ec2fleet.
SELECT
region,
target_capacity_specification,
on_demand_options,
type,
excess_capacity_termination_policy,
tag_specifications,
spot_options,
valid_from,
replace_unhealthy_instances,
launch_template_configs,
fleet_id,
terminate_instances_with_expiration,
valid_until,
context
FROM awscc.ec2.ec2fleets
WHERE
region = 'us-east-1' AND
Identifier = '{{ fleet_id }}';
Lists all ec2fleets in a region.
SELECT
region,
fleet_id
FROM awscc.ec2.ec2fleets_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new ec2fleet resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.ec2fleets (
TargetCapacitySpecification,
LaunchTemplateConfigs,
region
)
SELECT
'{{ target_capacity_specification }}',
'{{ launch_template_configs }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.ec2.ec2fleets (
TargetCapacitySpecification,
OnDemandOptions,
Type,
ExcessCapacityTerminationPolicy,
TagSpecifications,
SpotOptions,
ValidFrom,
ReplaceUnhealthyInstances,
LaunchTemplateConfigs,
TerminateInstancesWithExpiration,
ValidUntil,
Context,
region
)
SELECT
'{{ target_capacity_specification }}',
'{{ on_demand_options }}',
'{{ type }}',
'{{ excess_capacity_termination_policy }}',
'{{ tag_specifications }}',
'{{ spot_options }}',
'{{ valid_from }}',
'{{ replace_unhealthy_instances }}',
'{{ launch_template_configs }}',
'{{ terminate_instances_with_expiration }}',
'{{ valid_until }}',
'{{ context }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: ec2fleet
props:
- name: target_capacity_specification
value:
default_target_capacity_type: '{{ default_target_capacity_type }}'
target_capacity_unit_type: '{{ target_capacity_unit_type }}'
total_target_capacity: '{{ total_target_capacity }}'
on_demand_target_capacity: '{{ on_demand_target_capacity }}'
spot_target_capacity: '{{ spot_target_capacity }}'
- name: on_demand_options
value:
single_availability_zone: '{{ single_availability_zone }}'
allocation_strategy: '{{ allocation_strategy }}'
single_instance_type: '{{ single_instance_type }}'
min_target_capacity: '{{ min_target_capacity }}'
max_total_price: '{{ max_total_price }}'
capacity_reservation_options:
usage_strategy: '{{ usage_strategy }}'
- name: type
value: '{{ type }}'
- name: excess_capacity_termination_policy
value: '{{ excess_capacity_termination_policy }}'
- name: tag_specifications
value:
- resource_type: '{{ resource_type }}'
tags:
- key: '{{ key }}'
value: '{{ value }}'
- name: spot_options
value:
maintenance_strategies:
capacity_rebalance:
replacement_strategy: '{{ replacement_strategy }}'
termination_delay: '{{ termination_delay }}'
single_availability_zone: '{{ single_availability_zone }}'
allocation_strategy: '{{ allocation_strategy }}'
single_instance_type: '{{ single_instance_type }}'
min_target_capacity: '{{ min_target_capacity }}'
max_total_price: '{{ max_total_price }}'
instance_interruption_behavior: '{{ instance_interruption_behavior }}'
instance_pools_to_use_count: '{{ instance_pools_to_use_count }}'
- name: valid_from
value: '{{ valid_from }}'
- name: replace_unhealthy_instances
value: '{{ replace_unhealthy_instances }}'
- name: launch_template_configs
value:
- launch_template_specification:
launch_template_name: '{{ launch_template_name }}'
launch_template_id: '{{ launch_template_id }}'
version: '{{ version }}'
overrides:
- weighted_capacity: null
placement:
group_name: '{{ group_name }}'
tenancy: '{{ tenancy }}'
spread_domain: '{{ spread_domain }}'
partition_number: '{{ partition_number }}'
availability_zone: '{{ availability_zone }}'
affinity: '{{ affinity }}'
host_id: '{{ host_id }}'
host_resource_group_arn: '{{ host_resource_group_arn }}'
group_id: '{{ group_id }}'
priority: null
availability_zone: '{{ availability_zone }}'
subnet_id: '{{ subnet_id }}'
instance_type: '{{ instance_type }}'
instance_requirements:
v_cpu_count:
min: '{{ min }}'
max: '{{ max }}'
memory_mi_b:
min: '{{ min }}'
max: '{{ max }}'
cpu_manufacturers:
- '{{ cpu_manufacturers[0] }}'
memory_gi_bper_vcpu:
min: null
max: null
allowed_instance_types:
- '{{ allowed_instance_types[0] }}'
excluded_instance_types:
- '{{ excluded_instance_types[0] }}'
instance_generations:
- '{{ instance_generations[0] }}'
spot_max_price_percentage_over_lowest_price: '{{ spot_max_price_percentage_over_lowest_price }}'
on_demand_max_price_percentage_over_lowest_price: '{{ on_demand_max_price_percentage_over_lowest_price }}'
max_spot_price_as_percentage_of_optimal_on_demand_price: '{{ max_spot_price_as_percentage_of_optimal_on_demand_price }}'
bare_metal: '{{ bare_metal }}'
burstable_performance: '{{ burstable_performance }}'
require_hibernate_support: '{{ require_hibernate_support }}'
network_bandwidth_gbps:
min: null
max: null
network_interface_count:
min: '{{ min }}'
max: '{{ max }}'
local_storage: '{{ local_storage }}'
local_storage_types:
- '{{ local_storage_types[0] }}'
total_local_storage_gb:
min: null
max: null
baseline_ebs_bandwidth_mbps:
min: '{{ min }}'
max: '{{ max }}'
accelerator_types:
- '{{ accelerator_types[0] }}'
accelerator_count:
min: '{{ min }}'
max: '{{ max }}'
accelerator_manufacturers:
- '{{ accelerator_manufacturers[0] }}'
accelerator_names:
- '{{ accelerator_names[0] }}'
accelerator_total_memory_mi_b:
min: '{{ min }}'
max: '{{ max }}'
baseline_performance_factors:
cpu:
references:
- instance_family: '{{ instance_family }}'
max_price: '{{ max_price }}'
block_device_mappings:
- device_name: '{{ device_name }}'
ebs:
delete_on_termination: '{{ delete_on_termination }}'
encrypted: '{{ encrypted }}'
iops: '{{ iops }}'
snapshot_id: '{{ snapshot_id }}'
volume_size: '{{ volume_size }}'
volume_type: '{{ volume_type }}'
no_device: '{{ no_device }}'
virtual_name: '{{ virtual_name }}'
- name: terminate_instances_with_expiration
value: '{{ terminate_instances_with_expiration }}'
- name: valid_until
value: '{{ valid_until }}'
- name: context
value: '{{ context }}'
UPDATE example
Use the following StackQL query and manifest file to update a ec2fleet resource, using stack-deploy.
/*+ update */
UPDATE awscc.ec2.ec2fleets
SET PatchDocument = string('{{ {
"TargetCapacitySpecification": target_capacity_specification,
"ExcessCapacityTerminationPolicy": excess_capacity_termination_policy,
"Context": context
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ fleet_id }}';
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.ec2fleets
WHERE
Identifier = '{{ fleet_id }}' AND
region = 'us-east-1';
Permissions
To operate on the ec2fleets resource, the following permissions are required:
- Create
- Delete
- List
- Read
- Update
ec2:CreateFleet,
ec2:DescribeFleets
ec2:DescribeFleets,
ec2:DeleteFleets
ec2:DescribeFleets
ec2:DescribeFleets
ec2:ModifyFleet,
ec2:DescribeFleets