Skip to content

Asg

Bases: DuploResourceV2

Manage Duplo ASGs

Duplo ASGs (Auto Scaling Groups) manage the number of hosts within a tenant, enabling automatic scaling of instances based on demand.

See more details at: https://docs.duplocloud.com/docs/overview/use-cases/hosts-vms/auto-scaling/auto-scaling-groups

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 an ASG.

Creates a new Auto Scaling Group with the specified configuration. The ASG will manage EC2 instances based on the defined capacity settings and scaling policies.

CLI Usage

duploctl hosts create -f 'asg.yaml'
Contents of the asg.yaml file
FriendlyName: duploctl
Zone: 1
IsEbsOptimized: false
DesiredCapacity: 1
MinSize: 1
MaxSize: 2
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
IsClusterAutoscaled: true
IsMinion: true

Create an ASG using a one-liner.
echo """
FriendlyName: duploctl
Zone: 1
IsEbsOptimized: false
DesiredCapacity: 1
MinSize: 1
MaxSize: 2
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
IsClusterAutoscaled: true
IsMinion: true

""" | duploctl asg create -f -

Returns:

Name Type Description
message dict

Success message and the created ASG configuration.

Raises:

Type Description
DuploError

If the ASG could not be created due to invalid configuration or API errors.

Parameters:

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

delete

Delete an ASG.

Delete an Auto Scaling Group by its name. This will terminate all instances managed by the ASG and remove the ASG configuration.

CLI Usage
duploctl asg delete <name>

Returns:

Name Type Description
message dict

Success message confirming the ASG deletion.

Raises:

Type Description
DuploError

If the ASG could not be deleted or does not exist.

Parameters:

name positional
The resource name
str

find

Find an ASG by name.

Retrieve details of a specific Auto Scaling Group by its name.

CLI Usage
duploctl asg find <name>

Returns:

Name Type Description
dict

The ASG configuration including capacity, instance types, and other settings.

Raises:

Type Description
DuploError

If the ASG with the specified name could not be found.

Parameters:

name positional
The resource name
str

list

List all ASGs.

Retrieve the list of all Auto Scaling Groups in the tenant.

CLI Usage
duploctl asg list

Returns:

Name Type Description
list list

A list of all ASGs with their configurations.

scale

Scale an ASG.

Modify the capacity limits of an Auto Scaling Group. You can set new minimum and/or maximum instance counts. The ASG will automatically adjust the number of running instances to stay within these new bounds.

CLI Usage
duploctl asg scale -n <name> [-m <min>] [-M <max>]

Returns:

Name Type Description
message dict

Success message with the new scaling configuration.

Raises:

Type Description
DuploError

If neither min nor max is provided, or if the scaling operation fails.

Parameters:

name positional
The resource name
str
--min, -m
The minimum number of replicas
int
--max, -M
The maximum number of replicas
int

update

Update an ASG.

Update an existing Auto Scaling Group's configuration. This can include changes to capacity settings, instance types, scaling policies, and other parameters.

CLI Usage
duploctl asg update -f <file>

Returns:

Name Type Description
message dict

Success message and the updated ASG configuration.

Raises:

Type Description
DuploError

If the ASG could not be updated due to invalid configuration or API errors.

Parameters:

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

update_allocation_tags

Update the allocation tag for an Auto Scaling Group.

Updates the allocation tag for an existing Auto Scaling Group. The allocation tag is used to specify custom allocation rules for the ASG instances.

CLI Usage
duploctl asg update_allocation_tags <name> <allocationtags>
Update an ASG with new allocation tag
duploctl asg update_allocation_tags duploservices-test-asg duploctl

Returns:

Name Type Description
message dict

Success message and the updated ASG allocation tag.

Parameters:

name positional
The resource name
str
allocationtags positional
Allocation tag used to specify custom allocation rules
str

Methods

discover_image

name_from_body