NAME VM::EC2::REST::autoscaling
SYNOPSIS
use VM::EC2 ':autoscaling';
METHODS
This module provides VM::EC2 methods for autoscaling groups and launch configurations. Not all of the Amazon API is implemented, but the most common functions are available.
Implemented: CreateAutoScalingGroup CreateLaunchConfiguration DeleteAutoScalingGroup DeleteLaunchConfiguration DeletePolicy DescribeAutoScalingGroups DescribeLaunchConfigurations DescribePolicies ExecutePolicy PutScalingPolicy ResumeProcesses SuspendProcesses UpdateAutoScalingGroup
Unimplemented: CreateOrUpdateTags DeleteNotificationConfiguration DeleteScheduledAction DeleteTags DescribeAdjustmentTypes DescribeAutoScalingInstances DescribeAutoScalingNotificationTypes DescribeMetricCollectionTypes DescribeNotificationConfigurations DescribeScalingActivities DescribeScalingProcessTypes DescribeScheduledActions DescribeTags DescribeTerminationPolicyTypes DisableMetricsCollection EnableMetricsCollection PutNotificationConfiguration PutScheduledUpdateGroupAction SetDesiredCapacity SetInstanceHealth TerminateInstanceInAutoScalingGroup
@lc = $ec2->describe_launch_configurations(-names => \@names);
@lc = $ec->describe_launch_configurations(@names);
Provides detailed information for the specified launch configuration(s).
Optional parameters are:
-launch_configuration_names Name of the Launch config.
This can be a string scalar or an arrayref.
-name Alias for -launch_configuration_names
Returns a series of VM::EC2::LaunchConfiguration objects.
$success = $ec2->create_launch_configuration(%args);
Creates a new launch configuration.
Required arguments:
-name -- scalar, name for the Launch config.
-image_id -- scalar, AMI id which this launch config will use
-instance_type -- scalar, instance type of the Amazon EC2 instance.
Optional arguments:
-block_device_mappings -- list of hashref
-ebs_optimized -- scalar (boolean). false by default
-iam_instance_profile -- scalar
-instance_monitoring -- scalar (boolean). true by default
-kernel_id -- scalar
-key_name -- scalar
-ramdisk -- scalar
-security_groups -- list of scalars
-spot_price -- scalar
-user_data -- scalar
Returns true on successful execution.
$success = $ec2->delete_launch_configuration(-name => $name);
Deletes a launch config.
-name Required. Name of the launch config to delete
Returns true on success.
@asg = $ec2->describe_autoscaling_groups(-auto_scaling_group_names => \@names);
Returns information about autoscaling groups
-auto_scaling_group_names List of auto scaling groups to describe
-names Alias of -auto_scaling_group_names
Returns a list of VM::EC2::ASG.
$success = $ec2->create_autoscaling_group(-name => $name, -launch_config => $lc, -max_size => $max_size, -min_size => $min_size);
Creates a new autoscaling group.
Required arguments:
-name Name for the autoscaling group
-launch_config Name of the launch configuration to be used
-max_size Max number of instances to be run at once
-min_size Min number of instances
Optional arguments:
-availability_zones List of availability zone names
-load_balancer_names List of ELB names
-tags List of tags to apply to the instances run
-termination_policies List of policy names
-default_cooldown Time in seconds between autoscaling activities
-desired_capacity Number of instances to be run after creation
-health_check_type One of "ELB" or "EC2"
-health_check_grace_period Mandatory for health check type ELB. Number of
seconds between an instance is started and the
autoscaling group starts checking its health
-placement_group Physical location of your cluster placement group
-vpc_zone_identifier Strinc containing a comma-separated list of subnet
identifiers
Returns true on success.
$success = $ec2->delete_autoscaling_group(-name => $name)
Deletes an autoscaling group.
-name Name of the autoscaling group to delete
Returns true on success.
$success = $ec2->update_autoscaling_group(-name => $name);
Updates an autoscaling group. Only required parameter is -name
Optional arguments:
-availability_zones List of AZ's
-termination_policies List of policy names
-default_cooldown
-desired_capacity
-health_check_type
-health_check_grace_period
-launch_configuration_name
-placement_group
-vpc_zone_identifier
-max_size
-min_size
Returns true on success;
$success = $ec2->suspend_processes(-name => $asg_name, -scaling_processes => \@procs);
Suspend the requested autoscaling processes.
-name Name of the autoscaling group
-scaling_processes List of process names to suspend. Valid processes are:
Launch
Terminate
HealthCheck
ReplaceUnhealty
AZRebalance
AlarmNotification
ScheduledActions
AddToLoadBalancer
Returns true on success.
$success = $ec2->resume_processes(-name => $asg_name, -scaling_processes => \@procs);
Resumes the requested autoscaling processes. It accepts the same arguments than suspend_processes
.
Returns true on success.
@arguments = $ec2->autoscaling_tags($argname, \%args)
@asg = $ec2->describe_policies(-auto_scaling_group_name => $name);
Returns information about autoscaling policies
-auto_scaling_group_name The name of the Auto Scaling group
-policy_names An array of policy names or policy ARNs to be described. If this list is omitted, all policy names are described. If an auto scaling group name is provided, the results are limited to that group. The list of requested policy names cannot contain more than 50 items. If unknown policy names are requested, they are ignored with no error.
-names Alias of -auto_scaling_group_names
Returns a list of VM::EC2::ScalingPolicy.
$success = $ec2->put_scaling_policy
Creates or updates a policy for an Auto Scaling group.
Required arguments:
-policy_name The name of the policy to update or create.
-name Alias for -policy_name
-auto_scaling_group_name The name or ARN of the Auto Scaling group.
-scaling_adjustment Number of instances by which to scale.
-adjustment_type Specifies wheter -scaling_adjustment is an absolute
number or a percentage of the current capacity.
Valid values are:
ChangeInCapacity
ExactCapacity
PercentChangeInCapacity
Optional arguments:
-cooldown The amount of time, in seconds, after a scaling
activity completes and before the next scaling acitvity
can start.
-min_adjustment_step Used with PercentChangeInCapacity as -adjustment_type.
Returns true on success
$success = $ec2->delete_policy(-policy_name => $name)
Deletes a policy
Required arguments:
-policy_name Name or ARN of the policy
-name Alias for -policy_name
-auto_scaling_group_name Name of the Auto Scaling Group, required when
specifying policy by name (not by ARN)
Returns true on success
$success = $ec2->execute_policy(-policy_name => $name)
Runs a policy
Required arguments:
-policy_name Name or ARN of the policy
-name Alias for -policy_name
-auto_scaling_group_name Name of the Auto Scaling Group, required when
specifying policy by name (not by ARN)
Optional arguments:
-honor_cooldown Set to true if you want AutoScaling to reject
the request when it is in cooldown
Returns true on success
SEE ALSO
AUTHOR
Lincoln Stein <lincoln.stein@gmail.com>.
Copyright (c) 2011 Ontario Institute for Cancer Research
This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.