AWS Developer Tools Blog
Announcing the Modularized AWS SDK for Ruby (Version 3)
We’re excited to announce today’s stable release of version 3 of the AWS SDK for Ruby. The SDK is now available with over 100 service-specific gems (starting with aws-sdk-*
, such as aws-sdk-s3
) on RubyGems. You can find a full list of available service gems can be found at our GitHub landing page.
Features
Version 3 of the AWS SDK for Ruby modularizes the monolithic SDK into service-specific gems, for example, aws-sdk-s3
and aws-sdk-dynamodb
. Now each service gem uses strict semantic versioning, along with the benefits of continuous delivery of AWS API updates. With modularization, you can pick and choose which service gems your application or library requires, and update service gems independently of each other.
These new service-specific gems use statically generated code, rather than runtime-generated clients and types. This provides human-readable stack traces and code for API clients. Additionally, version 3 eliminates many thread safety issues by removing Ruby autoload
statements. When you require a service gem, such as aws-sdk-ec2
, all of the code is loaded upfront, avoiding sync issues with autoload
.
Furthermore, the SDK provides AWS Signature Version 4 signing functionality as a separate gem aws-sigv4
. This gem provides flexible signing usage for both AWS requests and customized scenarios.
Upgrading
We’ve provided a detailed upgrading guide with this release, which covers different upgrade scenarios. In short, the public-facing APIs are compatible, and so changes you need to make are focused on your Gemfile
and require
statements.
Most users of the SDK have a setup similar to this:
# Gemfile
gem 'aws-sdk', '~> 2'
# Code Files
require 'aws-sdk'
s3 = Aws::S3::Client.new
ddb = Aws::DynamoDB::Client.new
# etc.
If that’s you, the quickest migration path is to simply change your Gemfile
like so:
# Gemfile
gem 'aws-sdk', '~> 3'
However, this will pull in many new dependencies, as each service client has its own individual gem. As a direct user, you can also change to using only the service gems actually required by your project, which is the recommended path. This would involve a change to both your Gemfile
and to the code files where your require
statements live, like so:
# Gemfile
gem 'aws-sdk-s3', '~> 1'
gem 'aws-sdk-dynamodb', '~> 1'
# Code Files
require 'aws-sdk-s3'
require 'aws-sdk-dynamodb'
s3 = Aws::S3::Client.new
ddb = Aws::DynamoDB::Client.new
# etc.
Other upgrade cases are covered in the guide.
Feedback
Please share your questions, comments, issues, etc. with us on GitHub. You can also catch us in our Gitter channel.