salt.modules.boto_asg

Connection module for Amazon Autoscale Groups

2014.7.0 新版功能.

configuration:

This module accepts explicit autoscale credentials but can also utilize IAM roles assigned to the instance trough 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 a pillar or 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

If a region is not specified, the default is 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
depends:

boto

salt.modules.boto_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)

Create an autoscale group.

CLI example:

salt myminion boto_asg.create myasg mylc '["us-east-1a", "us-east-1e"]' 1 10 load_balancers='["myelb", "myelb2"]' tags='[{"key": "Name", value="myasg", "propagate_at_launch": True}]'
salt.modules.boto_asg.create_launch_configuration(name, image_id, key_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, volume_type=None, delete_on_termination=True, iops=None, use_block_device_types=False, region=None, key=None, keyid=None, profile=None)

Create a launch configuration.

CLI example:

salt myminion boto_asg.create_launch_configuration mylc image_id=ami-0b9c9f62 key_name='mykey' security_groups='["mygroup"]' instance_type='c3.2xlarge'
salt.modules.boto_asg.delete(name, force=False, region=None, key=None, keyid=None, profile=None)

Delete an autoscale group.

CLI example:

salt myminion boto_asg.delete myasg region=us-east-1
salt.modules.boto_asg.delete_launch_configuration(name, region=None, key=None, keyid=None, profile=None)

Delete a launch configuration.

CLI example:

salt myminion boto_asg.delete_launch_configuration mylc
salt.modules.boto_asg.exists(name, region=None, key=None, keyid=None, profile=None)

Check to see if an autoscale group exists.

CLI example:

salt myminion boto_asg.exists myasg region=us-east-1
salt.modules.boto_asg.get_cloud_init_mime(cloud_init)

Get a mime multipart encoded string from a cloud-init dict. Currently supports scripts and cloud-config.

命令行接口CLI 范例:

salt myminion boto.get_cloud_init_mime <cloud init>
salt.modules.boto_asg.get_config(name, region=None, key=None, keyid=None, profile=None)

Get the configuration for an autoscale group.

CLI example:

salt myminion boto_asg.get_config myasg region=us-east-1
salt.modules.boto_asg.get_instances(name, lifecycle_state='InService', health_status='Healthy', attribute='private_ip_address', attributes=None, region=None, key=None, keyid=None, profile=None)

return attribute of all instances in the named autoscale group.

CLI example:

salt-call boto_asg.get_instances my_autoscale_group_name
salt.modules.boto_asg.get_scaling_policy_arn(as_group, scaling_policy_name, region=None, key=None, keyid=None, profile=None)

Return the arn for a scaling policy in a specific autoscale group or None if not found. Mainly used as a helper method for boto_cloudwatch_alarm, for linking alarms to scaling policies.

命令行接口CLI 范例:

salt '*' boto_asg.get_scaling_policy_arn mygroup mypolicy
salt.modules.boto_asg.launch_configuration_exists(name, region=None, key=None, keyid=None, profile=None)

Check for a launch configuration's existence.

CLI example:

salt myminion boto_asg.launch_configuration_exists mylc
salt.modules.boto_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)

Update an autoscale group.

CLI example:

salt myminion boto_asg.update myasg mylc '["us-east-1a", "us-east-1e"]' 1 10 load_balancers='["myelb", "myelb2"]' tags='[{"key": "Name", value="myasg", "propagate_at_launch": True}]'