create_fleet
async
¶
create_fleet(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional[Boolean] = None,
client_token: Optional[String] = None,
spot_options: Optional[SpotOptionsRequest] = None,
on_demand_options: Optional[OnDemandOptionsRequest] = None,
reserved_capacity_options: Optional[ReservedCapacityOptionsRequest] = None,
excess_capacity_termination_policy: Optional[
FleetExcessCapacityTerminationPolicy
] = None,
launch_template_configs: Optional[FleetLaunchTemplateConfigListRequest] = None,
target_capacity_specification: Optional[TargetCapacitySpecificationRequest] = None,
terminate_instances_with_expiration: Optional[Boolean] = None,
type: Optional[FleetType] = None,
valid_from: Optional[DateTime] = None,
valid_until: Optional[DateTime] = None,
replace_unhealthy_instances: Optional[Boolean] = None,
tag_specifications: Optional[TagSpecificationList] = None,
context: Optional[String] = None,
) -> CreateFleetResult
Creates an EC2 Fleet that contains the configuration information for On-Demand Instances and Spot Instances. Instances are launched immediately if there is available capacity.
A single EC2 Fleet can include multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet.
For more information, see EC2 Fleet in the Amazon EC2 User Guide.
Parameters:
-
dry_run(Optional[Boolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
client_token(Optional[String], default:None) –Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.
For more information, see Ensuring idempotency.
-
spot_options(Optional[SpotOptionsRequest], default:None) –Describes the configuration of Spot Instances in an EC2 Fleet.
-
on_demand_options(Optional[OnDemandOptionsRequest], default:None) –Describes the configuration of On-Demand Instances in an EC2 Fleet.
-
reserved_capacity_options(Optional[ReservedCapacityOptionsRequest], default:None) –Defines EC2 Fleet preferences for utilizing reserved capacity when DefaultTargetCapacityType is set to
reserved-capacity.Supported only for fleets of type
instant. -
excess_capacity_termination_policy(Optional[FleetExcessCapacityTerminationPolicy], default:None) –Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.
Supported only for fleets of type
maintain. -
launch_template_configs(Optional[FleetLaunchTemplateConfigListRequest], default:None) –The configuration for the EC2 Fleet.
-
target_capacity_specification(Optional[TargetCapacitySpecificationRequest], default:None) –The number of units to request.
-
terminate_instances_with_expiration(Optional[Boolean], default:None) –Indicates whether running instances should be terminated when the EC2 Fleet expires.
-
type(Optional[FleetType], default:None) –The fleet type. The default value is
maintain.-
maintain- The EC2 Fleet places an asynchronous request for your desired capacity, and continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances. -
request- The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot capacity if Spot Instances are interrupted. -
instant- The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns errors for any instances that could not be launched.
For more information, see EC2 Fleet request types in the Amazon EC2 User Guide.
-
-
valid_from(Optional[DateTime], default:None) –The start date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). The default is to start fulfilling the request immediately.
-
valid_until(Optional[DateTime], default:None) –The end date and time of the request, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ). At this point, no new EC2 Fleet requests are placed or able to fulfill the request. If no value is specified, the request remains until you cancel it.
-
replace_unhealthy_instances(Optional[Boolean], default:None) –Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type
maintain. For more information, see EC2 Fleet health checks in the Amazon EC2 User Guide. -
tag_specifications(Optional[TagSpecificationList], default:None) –The key-value pair for tagging the EC2 Fleet request on creation. For more information, see Tag your resources.
If the fleet type is
instant, specify a resource type offleetto tag the fleet,instanceto tag the instances at launch,volumeto tag the volumes at launch, ornetwork-interfaceto tag the network interfaces at launch.If the fleet type is
maintainorrequest, specify a resource type offleetto tag the fleet. You cannot specify a resource type ofinstance,volume, ornetwork-interface. To tag instances at launch, specify the tags in a launch template. -
context(Optional[String], default:None) –Reserved.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ec2/_services/async_ec2.py
8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 | |