release_hosts

EC2.Client.release_hosts(**kwargs)

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.

See also: AWS API Documentation

Request Syntax

response = client.release_hosts(
    HostIds=[
        'string',
    ]
)
Parameters
HostIds (list) --

[REQUIRED]

The IDs of the Dedicated Hosts to release.

  • (string) --
Return type
dict
Returns
Response Syntax
{
    'Successful': [
        'string',
    ],
    'Unsuccessful': [
        {
            'Error': {
                'Code': 'string',
                'Message': 'string'
            },
            'ResourceId': 'string'
        },
    ]
}

Response Structure

  • (dict) --
    • Successful (list) --

      The IDs of the Dedicated Hosts that were successfully released.

      • (string) --
    • Unsuccessful (list) --

      The IDs of the Dedicated Hosts that could not be released, including an error message.

      • (dict) --

        Information about items that were not successfully processed in a batch call.

        • Error (dict) --

          Information about the error.

          • Code (string) --

            The error code.

          • Message (string) --

            The error message accompanying the error code.

        • ResourceId (string) --

          The ID of the resource.