Skip to content

Hosts

Bases: DuploResourceV2

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

Commands

apply

Apply a service.

Parameters:

--file, -f, --cli-input
A file to read the input from
FileType('r') action: YamlAction
--wait, -w
Wait for the operation to complete

create

Create a Host resource.

Creates a new host in the tenant with the specified configuration.

CLI Usage

duploctl hosts create -f 'hosts.yaml'
Contents of the hosts.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.large
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.large
Base64UserData: ''
TagsCsv: ''
AgentPlatform: 7
IsMinion: true

""" | duploctl hosts create -f -
Create and Wait

Supports global --wait flag to hold the terminal till the host is fully created and running.

duploctl hosts create -f hosts.yaml --wait

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.

Parameters:

--file, -f, --cli-input
A file to read the input from
FileType('r') action: YamlAction

delete

Delete a host.

Terminates a host by its name. This operation is irreversible and will destroy all data on the instance.

CLI Usage
duploctl hosts delete <name>
Delete and Wait

Supports global --wait flag to hold the terminal till the host is fully deleted.

duploctl hosts delete myhost --wait

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.

Parameters:

name positional
The resource name
str

find

Find a Hosts by name.

cli usage
duploctl hosts find <name>

Returns:

Name Type Description
resource dict

The Hosts object.

Raises:

Type Description
DuploError

If the {{kind}} could not be found.

Parameters:

name positional
The resource name
str

list

Retrieve a List of Hosts

cli usage
duploctl hosts list

Returns:

Name Type Description
list list

A list of Hosts.

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.

CLI Usage
duploctl hosts reboot <name>

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.

Parameters:

name positional
The resource name
str

start

Start a host.

Starts a stopped host. The instance will retain its configuration and data from when it was stopped.

CLI Usage
duploctl hosts start <name>
Start and Wait

Supports global --wait flag to hold the terminal till the host is fully started.

duploctl hosts start myhost --wait

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.

Parameters:

name positional
The resource name
str

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.

CLI Usage
duploctl hosts stop <name>
Stop and Wait

Supports global --wait flag to hold the terminal till the host is fully stopped.

duploctl hosts stop myhost --wait

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.

Parameters:

name positional
The resource name
str

Methods

discover_image

name_from_body