Hosts
Bases: DuploTenantResourceV2
Manage Duplo Hosts
Duplo hosts are virtual machines that run your services within a tenant. You can perform lifecycle operations like creating, deleting, starting, stopping and rebooting hosts. Hosts can be created with specific configurations like instance type, AMI, and other parameters.
See more details at: https://docs.duplocloud.com/docs/welcome-to-duplocloud/application-focussed-interface/duplocloud-common-components/hosts
apply
Apply a service.
create
Create a Host resource.
Creates a new host in the tenant with the specified configuration.
CLI Usage
Contents of thehosts.yaml
file
FriendlyName: duplohost
Zone: 0
IsEbsOptimized: false
DesiredCapacity: 0
MinSize:
MaxSize:
MetaData:
- Key: OsDiskSize
Value: 30
- Key: MetadataServiceOption
Value: enabled_v2_only
UseLaunchTemplate: true
CanScaleFromZero: false
IsUserDataCombined: true
KeyPairType:
Capacity: t3.small
Base64UserData: ''
TagsCsv: ''
AgentPlatform: 7
IsMinion: true
Create a host using a one-liner
echo """
FriendlyName: duplohost
Zone: 0
IsEbsOptimized: false
DesiredCapacity: 0
MinSize:
MaxSize:
MetaData:
- Key: OsDiskSize
Value: 30
- Key: MetadataServiceOption
Value: enabled_v2_only
UseLaunchTemplate: true
CanScaleFromZero: false
IsUserDataCombined: true
KeyPairType:
Capacity: t3.small
Base64UserData: ''
TagsCsv: ''
AgentPlatform: 7
IsMinion: true
""" | duploctl hosts create -f -
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
BODY
|
The host configuration including instance type, AMI, and other parameters. |
required |
wait
|
Whether to wait for the host to be fully created and running. |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message and the instance ID of the created host. |
Raises:
Type | Description |
---|---|
DuploError
|
If the host could not be created or the configuration is invalid. |
DuploFailedResource
|
If the host creation process fails. |
delete
Delete a host.
Terminates a host by its name. This operation is irreversible and will destroy all data on the instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the host to delete. |
required |
wait
|
Whether to wait for the host to be fully terminated. |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message confirming the host deletion. |
Raises:
Type | Description |
---|---|
DuploError
|
If the host does not exist or cannot be deleted. |
DuploFailedResource
|
If the deletion process fails. |
find
Find a Hosts by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the Hosts to find. |
required |
Returns:
Name | Type | Description |
---|---|---|
resource |
dict
|
The Hosts object. |
Raises:
Type | Description |
---|---|
DuploError
|
If the {{kind}} could not be found. |
list
reboot
Reboot a host.
Performs a graceful reboot of a host. This is equivalent to an operating system reboot command. The instance ID and data are preserved.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the host to reboot. |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message confirming the reboot request. |
Raises:
Type | Description |
---|---|
DuploError
|
If the host does not exist or cannot be rebooted. |
start
Start a host.
Starts a stopped host. The instance will retain its configuration and data from when it was stopped.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the host to start. |
required |
wait
|
Whether to wait for the host to reach running state. |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message confirming the host has been started. |
Raises:
Type | Description |
---|---|
DuploError
|
If the host does not exist or cannot be started. |
DuploFailedResource
|
If the start process fails. |
stop
Stop a host.
Stops a running host. The instance can be restarted later using the start command. Stopped instances do not incur compute charges but still incur storage costs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the host to stop. |
required |
wait
|
Whether to wait for the host to reach stopped state. |
required |
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message confirming the host has been stopped. |
Raises:
Type | Description |
---|---|
DuploError
|
If the host does not exist or cannot be stopped. |
DuploFailedResource
|
If the stop process fails. |