Class: AWS::AutoScaling

Inherits:
Object
  • Object
show all
Includes:
Core::ServiceInterface
Defined in:
lib/aws/auto_scaling.rb,
lib/aws/auto_scaling/tag.rb,
lib/aws/auto_scaling/group.rb,
lib/aws/auto_scaling/client.rb,
lib/aws/auto_scaling/errors.rb,
lib/aws/auto_scaling/request.rb,
lib/aws/auto_scaling/activity.rb,
lib/aws/auto_scaling/instance.rb,
lib/aws/auto_scaling/group_options.rb,
lib/aws/auto_scaling/scaling_policy.rb,
lib/aws/auto_scaling/tag_collection.rb,
lib/aws/auto_scaling/group_collection.rb,
lib/aws/auto_scaling/scheduled_action.rb,
lib/aws/auto_scaling/activity_collection.rb,
lib/aws/auto_scaling/instance_collection.rb,
lib/aws/auto_scaling/launch_configuration.rb,
lib/aws/auto_scaling/scaling_policy_options.rb,
lib/aws/auto_scaling/scaling_policy_collection.rb,
lib/aws/auto_scaling/notification_configuration.rb,
lib/aws/auto_scaling/scheduled_action_collection.rb,
lib/aws/auto_scaling/launch_configuration_collection.rb,
lib/aws/auto_scaling/notification_configuration_collection.rb

Overview

This class is the starting point for working with Auto Scaling.

To use Auto Scaling you must first sign up here.

For more information about Auto Scaling:

Credentials

You can setup default credentials for all AWS services via AWS.config:

AWS.config(
  :access_key_id => 'YOUR_ACCESS_KEY_ID',
  :secret_access_key => 'YOUR_SECRET_ACCESS_KEY')

Or you can set them directly on the AWS::AutoSclaing interface:

auto_scaling = AWS::AutoScaling.new(
  :access_key_id => 'YOUR_ACCESS_KEY_ID',
  :secret_access_key => 'YOUR_SECRET_ACCESS_KEY')

Launch Configurations

You need to create a launch configuration before you can create an Auto Scaling Group.

# needs a name, image id, and instance type
launch_config = auto_scaling.launch_configurations.create(
  'launch-config-name', 'ami-12345', 'm1-small')

If you have previously created a launch configuration you can reference using the LaunchConfigurationCollection.

launch_config = auto_scaling.launch_configurations['launch-config-name']

Auto Scaling Groups

Given a launch configuration, you can now create an Auto Scaling Group.

group = auto_scaling.groups.create('group-name', 
  :launch_configuration => launch_config,
  :availability_zones => %(us-east-1a us-east-1b),
  :min_size => 1,
  :max_size => 4)

Defined Under Namespace

Modules: Errors, GroupOptions, ScalingPolicyOptions Classes: Activity, ActivityCollection, Client, Group, GroupCollection, Instance, InstanceCollection, LaunchConfiguration, LaunchConfigurationCollection, NotificationConfiguration, NotificationConfigurationCollection, Request, ScalingPolicy, ScalingPolicyCollection, ScheduledAction, ScheduledActionCollection, Tag, TagCollection

Instance Method Summary collapse

Methods included from Core::ServiceInterface

included, #initialize, #inspect

Instance Method Details

#activitiesActivityCollection

Returns:



124
125
126
# File 'lib/aws/auto_scaling.rb', line 124

def activities
  ActivityCollection.new(:config => config)
end

#adjustment_typesArray<String>

Returns the list of valid adjustmet types.

Returns:

  • (Array<String>)

    Returns the list of valid adjustmet types.



142
143
144
# File 'lib/aws/auto_scaling.rb', line 142

def adjustment_types
  client.describe_adjustment_types.adjustment_types.map(&:adjustment_type)
end

#groupsGroupCollection

Returns:



102
103
104
# File 'lib/aws/auto_scaling.rb', line 102

def groups
  GroupCollection.new(:config => config)
end

#launch_configurationsLaunchConfigurationCollection



97
98
99
# File 'lib/aws/auto_scaling.rb', line 97

def launch_configurations
  LaunchConfigurationCollection.new(:config => config)
end

#metric_collection_granularitiesArray<String>

Returns the list of valid metric granularities.

Returns:

  • (Array<String>)

    Returns the list of valid metric granularities.



157
158
159
# File 'lib/aws/auto_scaling.rb', line 157

def metric_collection_granularities
  client.describe_metric_collection_types.granularities.map(&:granularity)
end

#metric_collection_typesArray<String>

Returns the list of valid metric collection types.

Returns:

  • (Array<String>)

    Returns the list of valid metric collection types.



152
153
154
# File 'lib/aws/auto_scaling.rb', line 152

def metric_collection_types
  client.describe_metric_collection_types.metrics.map(&:metric)
end

#notification_configurationsNotificationConfigurationCollection



112
113
114
# File 'lib/aws/auto_scaling.rb', line 112

def notification_configurations
  NotificationConfigurationCollection.new(:config => config)
end

#notification_typesArray<String>

Returns a list of all notification types that are supported by Auto Scaling.

Returns:

  • (Array<String>)


136
137
138
139
# File 'lib/aws/auto_scaling.rb', line 136

def notification_types
  resp = client.describe_auto_scaling_notification_types
  resp.auto_scaling_notification_types
end

#scaling_process_typesArray<String>

Returns the list of valid scaling process types.

Returns:

  • (Array<String>)

    Returns the list of valid scaling process types.



147
148
149
# File 'lib/aws/auto_scaling.rb', line 147

def scaling_process_types
  client.describe_scaling_process_types.processes.map(&:process_name)
end

#scheduled_actionsScheduledActionCollection



129
130
131
# File 'lib/aws/auto_scaling.rb', line 129

def scheduled_actions
  ScheduledActionCollection.new(:config => config)
end

#tagsTagCollection

Returns:



107
108
109
# File 'lib/aws/auto_scaling.rb', line 107

def tags
  TagCollection.new(:config => config)
end