Release: AWS SDK for Ruby 1.3.0
This release adds support for Amazon DynamoDB and fixes 2 bugs.
Latest Version
Download the latest version of the AWS SDK for Ruby:
gem install aws-sdk
New Features
| Change | Description |
|---|---|
| AWS::DynamoDB |
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. Using the AWS Management Console or the AWS SDKs customers can easily launch a new Amazon DynamoDB database table, scale up or down their request capacity for the table without downtime or performance degradation, and gain visibility into resource utilization and performance metrics. Amazon DynamoDB enables customers to offload the administrative burdens of operating and scaling distributed databases to AWS, so they don't have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling. # create a table (10 read and 5 write capacity units)
dynamo_db = AWS::DynamoDB.new
table = dynamo_db.tables.create('my-table', 10, 5, :hash_key => [:id, :string])
sleep 1 while table.status == :creating
table.status #=> :active
# get a table by name and specify its schema
table = dynamo_db.tables['ruby-test-2']
table.hash_key = [:id, :number]
# add an item
item = table.items.create('id' => 12345, 'foo' => 'bar')
# add attributes to an item
item.attributes.add 'category' => %w(demo), 'tags' => %w(sample item)
# update an item with mixed add, delete, update
item.attributes.update do |u|
u.add 'colors' => %w(red)
u.set 'category' => 'demo-category'
u.delete 'foo'
end
# delete attributes
item.attributes.delete 'colors', 'category'
# get attributes
item.attributes.to_h
#=> {"id"=>#
See the AWS SDK for Ruby documentation for more information on working with Amazon DynamoDB. |
| AWS::Record::HashModel |
AWS::Record::Base has been refactored to support Amazon DynamoDB. To accommodate two storage backends, it has been split into AWS::Record::Model and AWS::Record::HashModel. # use Amazon DynamoDB for ORM storage
class Product < AWS::Record::HashModel
string_attr :name
end
# creating a new record
product = Product.new(:name => 'prod-a')
product.save
# find an existing record
product = Product.find('product-id')
# enumerate products
Product.limit(100).each do |product|
# ...
end
AWS::Record::HashModel is very similar to the old AWS::Record::Base, but with limited scoped finders. You can find records by id, or enumerate all records with an optional limit. |
| AWS::Record::Base deprecated |
The AWS::Record::Base has been renamed to AWS::Record::Model to be more consistent with AWS::Record::HashModel. Extending AWS::Record::Base is now deprecated. Sharding methods and options with "domain" in their name is now deprecated. New method and option names replace "domain" with "shard". # deprecated usage class Book < AWS::Record::Base set_domain_name 'books-1' end book = Book.new(:domain => 'books-2') # override default domain name book.domain #=> 'books-2' # new approach class Book < AWS::Record::Model set_shard_name 'books-1' end book = Book.new(:shard => 'books-2') # override default domain name book.shard #=> 'books-2' |
Resolved Issues
| Change | Description |
|---|---|
| AWS::EC2::ResourceTagCollection#method_missing fix |
Accessing tag values by the tag name method was broken and would raise a NoMethodError. This has been resolved. # get the "role" tag from the ec2 instnace via method missing ec2 = AWS::EC2.new instance = ec2.instances.first instance.tags.role #=> 'webserver' |
| AWS::Record Multiattribute value assignments |
Rails view helpers (e.g. datetime_select, date_select, time_select) post their values as multiple attributes. AWS::Record::Base would raise an error when bulk assigning a date/time attribute split into parts. This has been resolved. |
Supported API Versions
This release of the SDK supports the following API versions:
| Service | API Version |
|---|---|
| Amazon DynamoDB | 2011-12-05 |
| Amazon Elastic Compute Cloud | 2011-02-28 |
| Amazon Simple E-mail Service | 2010-12-01 |
| Amazon Simple Notifications Service | 2010-03-31 |
| Amazon Simple Queue Service | 2011-10-01 |
| Amazon Simple Storage Service | 2006-03-01 |
| Amazon SimpleDB | 2009-04-15 |
| AWS Identity and Access Management | 2010-05-08 |
| AWS Security Token Service | 2011-06-15 |
| Elastic Load Balancing | 2011-08-15 |