When you no longer want to use an On-Demand Dedicated Host it can be released. On-Demand billing is stopped and the host goes into released state. The host ID of Dedicated Hosts that have been released can no longer be specified in another request, for example, to modify the host. You must stop or terminate all instances on a host before it can be released.
When Dedicated Hosts are released, it may take some time for them to stop counting toward your limit and you may receive capacity errors when trying to allocate new Dedicated Hosts. Wait a few minutes and then try again.
Released hosts still appear in a DescribeHosts response.
Parameters:
Raises:
Source code in docs_src/capo_ec2/_services/async_ec2.py
| async def release_hosts(
self,
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
host_ids: Optional[
"capo_ec2.types.request_host_id_list.RequestHostIdList"
] = None,
) -> "capo_ec2.types.release_hosts_result.ReleaseHostsResult":
"""<p>When you no longer want to use an On-Demand Dedicated Host it can be released. On-Demand billing is stopped and the host goes into <code>released</code> state. The host ID of Dedicated Hosts that have been released can no longer be specified in another request, for example, to modify the host. You must stop or terminate all instances on a host before it can be released.</p> <p>When Dedicated Hosts are released, it may take some time for them to stop counting toward your limit and you may receive capacity errors when trying to allocate new Dedicated Hosts. Wait a few minutes and then try again.</p> <p>Released hosts still appear in a <a>DescribeHosts</a> response.</p>
Args:
host_ids: <p>The IDs of the Dedicated Hosts to release.</p>
Raises:
capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_ec2.types.release_hosts_request.ReleaseHostsRequest]",
) -> AsyncOperationResponse[
"capo_ec2.types.release_hosts_result.ReleaseHostsResult"
]:
import capo_ec2._operations.amazon_ec2.release_hosts
(
output,
http_response,
) = await capo_ec2._operations.amazon_ec2.release_hosts.async_release_hosts(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ReleaseHosts")
)
input_: capo_ec2.types.release_hosts_request.ReleaseHostsRequest = {}
if host_ids is not None:
input_["host_ids"] = host_ids
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|