boto3_asg¶
Connection module for Amazon Autoscale Groups using boto3.¶
Renamed from
boto_asgtoboto3_asgand rewritten to use the boto3autoscaling(andec2) client APIs directly viasaltext.boto3.utils.boto3mod. The legacy boto2 code path (object-style access, retry loops) has been removed.
- depends:
boto3 >= 1.28.0
botocore >= 1.31.0
- configuration:
This module accepts explicit autoscale credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in the minion’s config file or as a profile. For example, to specify them in the minion’s config file:
asg.keyid: GKTADJGHEIQSXMKKRBJ08H
asg.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
A region may also be specified in the configuration:
asg.region: us-east-1
It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
Added in version 1.0.0.
- saltext.boto3.modules.boto3_asg.__virtual__()[source]¶
Only load if boto3 is available. Minimum version is enforced via the project’s
pyproject.tomldependency declaration.
- saltext.boto3.modules.boto3_asg.exists(name, region=None, key=None, keyid=None, profile=None)[source]¶
Check to see if an autoscale group exists.
CLI Example:
salt myminion boto3_asg.exists myasg region=us-east-1
- saltext.boto3.modules.boto3_asg.get_config(name, region=None, key=None, keyid=None, profile=None)[source]¶
Get the configuration for an autoscale group.
CLI Example:
salt myminion boto3_asg.get_config myasg region=us-east-1
- saltext.boto3.modules.boto3_asg.create(name, launch_config_name, availability_zones, min_size, max_size, desired_capacity=None, load_balancers=None, default_cooldown=None, health_check_type=None, health_check_period=None, placement_group=None, vpc_zone_identifier=None, tags=None, termination_policies=None, suspended_processes=None, scaling_policies=None, scheduled_actions=None, region=None, notification_arn=None, notification_types=None, key=None, keyid=None, profile=None)[source]¶
Create an autoscale group.
CLI Example:
salt myminion boto3_asg.create myasg mylc '["us-east-1a", "us-east-1e"]' 1 10
- saltext.boto3.modules.boto3_asg.update(name, launch_config_name, availability_zones, min_size, max_size, desired_capacity=None, load_balancers=None, default_cooldown=None, health_check_type=None, health_check_period=None, placement_group=None, vpc_zone_identifier=None, tags=None, termination_policies=None, suspended_processes=None, scaling_policies=None, scheduled_actions=None, notification_arn=None, notification_types=None, region=None, key=None, keyid=None, profile=None)[source]¶
Update an autoscale group.
CLI Example:
salt myminion boto3_asg.update myasg mylc '["us-east-1a", "us-east-1e"]' 1 10
- saltext.boto3.modules.boto3_asg.delete(name, force=False, region=None, key=None, keyid=None, profile=None)[source]¶
Delete an autoscale group.
CLI Example:
salt myminion boto3_asg.delete myasg region=us-east-1
- saltext.boto3.modules.boto3_asg.get_cloud_init_mime(cloud_init)[source]¶
Get a mime multipart encoded string from a cloud-init dict. Currently supports boothooks, scripts and cloud-config.
CLI Example:
salt myminion boto3_asg.get_cloud_init_mime <cloud init>
- saltext.boto3.modules.boto3_asg.launch_configuration_exists(name, region=None, key=None, keyid=None, profile=None)[source]¶
Check for a launch configuration’s existence.
CLI Example:
salt myminion boto3_asg.launch_configuration_exists mylc
- saltext.boto3.modules.boto3_asg.get_all_launch_configurations(region=None, key=None, keyid=None, profile=None)[source]¶
Fetch and return all Launch Configurations with details.
CLI Example:
salt myminion boto3_asg.get_all_launch_configurations
- saltext.boto3.modules.boto3_asg.list_launch_configurations(region=None, key=None, keyid=None, profile=None)[source]¶
List all Launch Configuration names.
CLI Example:
salt myminion boto3_asg.list_launch_configurations
- saltext.boto3.modules.boto3_asg.describe_launch_configuration(name, region=None, key=None, keyid=None, profile=None)[source]¶
Dump details of a given launch configuration.
CLI Example:
salt myminion boto3_asg.describe_launch_configuration mylc
- saltext.boto3.modules.boto3_asg.create_launch_configuration(name, image_id, key_name=None, vpc_id=None, vpc_name=None, security_groups=None, user_data=None, instance_type='m1.small', kernel_id=None, ramdisk_id=None, block_device_mappings=None, instance_monitoring=False, spot_price=None, instance_profile_name=None, ebs_optimized=False, associate_public_ip_address=None, region=None, key=None, keyid=None, profile=None)[source]¶
Create a launch configuration.
CLI Example:
salt myminion boto3_asg.create_launch_configuration mylc image_id=ami-0b9c9f62
- saltext.boto3.modules.boto3_asg.delete_launch_configuration(name, region=None, key=None, keyid=None, profile=None)[source]¶
Delete a launch configuration.
CLI Example:
salt myminion boto3_asg.delete_launch_configuration mylc
- saltext.boto3.modules.boto3_asg.get_scaling_policy_arn(as_group, scaling_policy_name, region=None, key=None, keyid=None, profile=None)[source]¶
Return the arn for a scaling policy in a specific autoscale group or
Noneif not found. Mainly used as a helper method for boto_cloudwatch_alarm, for linking alarms to scaling policies.CLI Example:
salt '*' boto3_asg.get_scaling_policy_arn mygroup mypolicy
- saltext.boto3.modules.boto3_asg.get_all_groups(region=None, key=None, keyid=None, profile=None)[source]¶
Return all AutoScale Groups visible in the account as a list of boto3 describe-response dicts.
CLI Example:
salt-call boto3_asg.get_all_groups region=us-east-1 --output yaml
- saltext.boto3.modules.boto3_asg.list_groups(region=None, key=None, keyid=None, profile=None)[source]¶
Return all AutoScale Group names visible in the account.
CLI Example:
salt-call boto3_asg.list_groups region=us-east-1
- saltext.boto3.modules.boto3_asg.get_instances(name, lifecycle_state='InService', health_status='Healthy', attribute='private_ip_address', attributes=None, region=None, key=None, keyid=None, profile=None)[source]¶
Return an attribute of all instances in the named autoscale group.
CLI Example:
salt-call boto3_asg.get_instances my_autoscale_group_name