Tag: V2

AWS SDK for Ruby Core Developer Preview

by Trevor Rowe | on | in Ruby | Permalink | Comments |  Share

A few months ago, Loren blogged about the upcoming version 2 of the AWS SDK for Ruby. Shortly after that, we published our work-in-progress code to GitHub as aws/aws-sdk-core-ruby. I am happy to announce that AWS SDK Core has stabilized enough to enter a developer preview period. It currently supports 30+ services.

To install AWS SDK Core from Rubygems:

gem install aws-sdk-core --pre

Or with Bundler:

gem 'aws-sdk-core'

What is AWS SDK Core?

Version 2 of the Ruby SDK will separate the higher level service abstractions from the service clients. We are focusing our initial efforts to ensure the new client libraries are robust, extensible, and more capable than those in version 1. We are still exploring how best to migrate higher level abstractions from version 1 into version 2.

AWS SDK Core uses a different namespace. This allows you to install both aws-sdk and aws-sdk-core in the same application.

Versioning Strategy

AWS SDK Core is being released as version ‘2.0.0-rc.1’. This shows our intention that core will be the successor to the current Ruby SDK.

Links of Interest

AWS SDK Core Response Structures

by Trevor Rowe | on | in Ruby | Permalink | Comments |  Share

I blogged recently about how the code is now available for AWS SDK Core. This new repository is the basis for what will become version 2 of the AWS SDK for Ruby.

We have not cut a public gem for AWS SDK Core yet. Instead, we have published the work-in-progress code to GitHub for the community to see. We hope to get a lot of feedback on features as they are developed. In an effort to engage the community, I will be blogging about some of these new features and soliciting feedback. Our hope is to improve the overall quality of version 2 of the Ruby SDK through this process.

Today, I will talking about the new response structures.

V1 Response Strutures

In version 1 of the Ruby SDK, the low-level clients accepted a hash of request parameters, and then returned response data as a hash. Here is a quick example:

# hash in, hash out
response = AWS::S3::Client.new.list_buckets(limit: 2)
pp response.data

  {:name=>"aws-sdk", :creation_date=>"2012-03-19T16:37:04.000Z"},
  {:name=>"aws-sdk-2", :creation_date=>"2013-09-27T16:17:02.000Z"}],

This approach is simple and flexible. However, it gives little guidance when exploring a response. Here are some issues that arise from using hashes:

  • Attempts to access unset response keys return a nil value. There is no way to tell if the service omitted the value or if the hash key contains a typo.

  • Operating on nested values is a bit awkward. To collect bucket names, a user would need to use blocks to access attributes:

    data[:buckets].map{ |b| b[:name] }
  • The response structure gives no information about what other attributes the described resource might also have, only what is present currently.

V2 Response Structures

In AWS SDK Core, we take a different approach. We use descriptions about the complete response structure to construct Ruby Struct objects. Here is the sample from above with version 2:

#=> #<struct 
  [#<struct name="aws-sdk", creation_date=2012-03-19 16:37:04 UTC>,
   #<struct name="aws-sdk-2", creation_date=2013-09-27 16:17:02 UTC>],

Struct objects provide the following benefits:

  • Indifferent access with strings, symbols, and methods:

  • Operating on nested values possible using Symbol-to-Proc semantics:

  • Accessing an invalid property raises an error:

    #=> raises NoMethodError: undefined method `color' for #<struct ...>


What do you think about the new response structures? Take a moment to checkout the new code and give it a spin. We would love to hear your feedback. Issues and feature requests are welcome. Come join us on GitHub.

Introducing AWS SDK Core

by Trevor Rowe | on | in Ruby | Permalink | Comments |  Share

We’ve been working hard on version 2 of the AWS SDK for Ruby. Loren blogged about some of our upcoming plans for version 2. I’m excited to pull back the curtains and show off the work we’ve done on version 2 of the Ruby SDK.


The AWS SDK Core library will provide a single client for each of the Amazon Web Services we support. Our initial goal is reach feature parity between AWS SDK Core clients and Ruby SDK version 1 clients. We have made good progress, but there are some missing features, e.g., retry logic, logging, API reference docs, etc.

We are currently evaluating how to provide higher level abstractions like those found in version 1. This is not our current focus.

You can learn more about how AWS SDK Core from the project README.

A New Namespace

If you dig around the AWS SDK Ruby Core source code on GitHub you may notice we have changed namespaces from AWS:: to Aws::. We want to make it possible for users to install versions 1 and 2 of the Ruby SDK in the same project. This will make it much easier to try out the new code and to upgrade at will.

Whats Next?

After client parity, there are a lot of things on our todo list. We are releasing the code now so that we can solicit your feedback. Your feedback helps us pick our priorities. Check it out and drop us a note!