Asg
Bases: DuploTenantResourceV2
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
apply
Apply a service.
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
Contents of theasg.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.small
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.small
Base64UserData: ''
TagsCsv: ''
AgentPlatform: 7
IsClusterAutoscaled: true
IsMinion: true
""" | duploctl asg create -f -
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
BODY
|
The complete ASG configuration including instance type, capacity settings, and other parameters. |
required |
wait
|
Whether to wait for the ASG to be fully created and ready. |
required |
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. |
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the ASG to delete. |
required |
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. |
find
Find an ASG by name.
Retrieve details of a specific Auto Scaling Group by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the ASG to find. |
required |
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. |
list
List all ASGs.
Retrieve the list of all Auto Scaling Groups in the tenant.
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
NAME
|
The name of the ASG to scale. |
required |
min
|
MIN
|
The new minimum number of instances the ASG should maintain. Use -m flag to set. |
None
|
max
|
MAX
|
The new maximum number of instances the ASG can scale to. Use -M flag to set. |
None
|
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. |
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.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
BODY
|
The updated ASG configuration. Must include the FriendlyName of the existing ASG. |
required |
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. |