create_fleet
¶
create_fleet(
*,
config_overrides: Optional[EC2ClientConfig] = 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/ec2.py
8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 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 | |