Class | AWS::AutoScaling::NotificationConfigurationCollection |
In: |
lib/aws/auto_scaling/notification_configuration_collection.rb
|
Parent: | Object |
Allows you to enumerate and create notification configurations.#
You can enumerated ALL configurations from the AWS::AutoScaling class.
auto_scaling = AWS::AutoScaling.new auto_scaling.notification_configurations.each do |config| # ... end
You can also limit them to a single Auto Scaling group:
group = auto_scaling.groups['group-name'] group.notification_configurations.each do |config| # ... end
You can create a notification configuration like so:
auto_scaling.notification_configurations.create( :group => 'auto-scaling-group-name', :topic => 'sns-topic-arn')
Just like with enumeration, you can create them from the Auto Scaling group:
group.notification_configurations.create(:topic => 'sns-topic-arn')
group | -> | auto_scaling_group |
group | [R] |
@return [Group,nil] If this collection was
initialized with
an Auto Scaling group, then that group is returned, nil otherwise. |
Creates a new notification configuration. To create a notification configuration you need an {SNS::Topic} and an Auto Scaling {Group}.
auto_scaling.notification_configurations.create( :group => 'auto-scaling-group-name', :topic => 'sns-topic-arn')
You can also create notification configurations from an Auto Scaling group and omit the +:group+ option.
auto_scaling_group.notification_configurations.create( :topic => 'sns-topic-arn')
You may also pass a list of notification types to publish to the topic. If you omit this option, then all notification types will be configured.
# publish only these two specific notification types auto_scaling_group.notification_configurations.create( :topic => 'sns-topic-arn', :types => [ 'autoscaling:EC2_INSTANCE_LAUNCH', 'autoscaling:EC2_INSTANCE_TERMINATE', ] )
@param [Hash] options
@option options [required,SNS::Topic,String] :topic An {SNS::Topic}
object or a topic arn string. Notifications will be published to this topic.
@option options [Group,String] :group An Auto Scaling {Group} object
or the name of an Auto Scaling group. This is required if you this collection is not scoped by a {Group}.
@option options [Array<String>] :types A list of notification
types that should publish messages to the given topic.
@return [NotificationConfiguration]
@yield [notification_config] @yieldparam [NotificationConfiguration] notification_config