Release: AWS SDK for Ruby 1.2.0

Release Notes>Ruby>Release: AWS SDK for Ruby 1.2.0
This release adds support for Elastic Load Balancing and new features for Amazon SimpleDB, Amazon S3 and AWS::Record.

Details

Submitted By: trevor@AWS
Release Date: October 5, 2011 1:03 AM GMT
Latest Version: 1.2.0
Created On: October 5, 2011 1:04 AM GMT
Last Updated: October 5, 2011 1:04 AM GMT

Latest Version

Download the latest version of the AWS SDK for Ruby:

gem install aws-sdk

New Features

Change Description
Added support for Elastic Load Balancing.

We have added support for Elastic Load Balancing. Here is an example of using the aws-sdk gem to create a load balancer.

# create a new load balancer
elb = AWS::ELB.new
load_balancer = elb.load_balancers.create('my-load-balancer',
  :availability_zones => %w(us-east-1a us-east-1b),
  :listeners => [{
    :port => 80,
    :protocol => :http,
    :instance_port => 80,
    :instance_protocol => :http,
  }])
            

AWS::ELB also integrates with AWS::EC2 and AWS::IAM to simplify configuring your load balancers.

AWS::S3 Server Side Encryption

Customers now have the option to encrypt data stored "at rest" within Amazon S3. Amazon S3 Server Side Encryption provides customers with the ability to easily encrypt data -- securing their data in the cloud -- without the burden of building, managing, and securing a key management infrastructure.

# write an object to S3 and have it stored encrypted
obj = bucket.objects['key']
obj.write("Hello World!', :server_side_encryption => :aes256)
obj.server_side_encryption #=> :aes256

# enable server side encryption for all S3 objects
AWS.config(:s3_server_side_encryption => :aes256)
            

For more information on encrypting your data using Amazon S3 Server Side Encryption, please see the Amazon S3 Developer Guide.

AWS::SimpleDB::ItemCollection#page

An interface has been added that makes it possible to page items in SimpleDB with a very basic interface.

popular_items = domain.items.order(:avg_rating, :desc)
page = popular_items.page(:per_page => 25)
page.is_a?(Array) #=> true
page.each {|item| ... }
page.last_page? #=> false

# use the item collection to get the next page
page2 = popular_items.page(:per_page => 25, :next_token => page.next_token)

# or use the page of results to get the next page
page2 = page.next_page
            
AWS::Record Attribute Assignments

AWS::Record::Base now supports updating attributes without updating the record in SimpleDB via #attributes=.

product = Product.find(123456)
product.attributes = { :sizes => %w(large xlarge), :price => 100 }
product.changed? #=> true
product.save!
product.changed? #=> false
            
AWS::Record Custom Validators

You can now define custom validation methods for AWS::Record. Call validate with one or more method names. validate also accepts a hash of options (e.g. :if, :unless and :on to affect when the validation methods are called.

class Book < AWS::Record::Base
  string_attr :title          
  string_attr :author

  validate :validate_author_is_real, :if => :author_changed?

  def validate_author_is_real
    errors.add(:author, 'must be a real author') if author =~ /john doe/i
  end

end
            
Configurable max string length for logging.

When logging service requests, you can now specify the maximum length for each string in the request. Strings now only truncate after the first 1k characters by default. You can change this via AWS.config:

AWS.config(:logger_truncate_strings_at => 250)

Resolved Issues

Change Description
AWS::Record::RecordNotFound is not StandardError

AWS::Record::RecordNotFound now correctly inherits from StandardError instead of from Exception. This makes it easier to catch and to handle.

Supported API Versions

This release of the SDK supports the following API versions:

Service API Version
Amazon Elastic Compute Cloud 2011-02-28
Amazon SimpleDB 2009-04-15
Amazon Simple E-mail Service 2010-12-01
Amazon Simple Notifications Service 2010-03-31
Amazon Simple Queue Service 2009-02-01
Amazon Simple Storage Service 2006-03-01
AWS Identity and Access Management 2010-05-08
AWS Security Token Service 2011-06-15
Elastic Load Balancing 2011-08-15
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.