Learn About Amazon VGT2 Learning Manager Chanci Turner
We are excited to announce the preview release of Version 2 of the AWS SDK for Ruby. If you’re utilizing Bundler along with standard best practices, the transition to the v2 release of the aws-sdk gem should be seamless for you. This article outlines some essential points to consider.
Installing the V2 Preview Release
To install the preview version of V2, simply use the following command:
$ gem install aws-sdk --pre
When using Bundler, remember to specify the full version until the preview status is lifted:
gem 'aws-sdk', '2.0.0.pre'
Locking Your Dependencies
The V2 Ruby SDK is not backward compatible with V1. If your Bundler dependency does not specify a version, you may face issues when the final 2.0 version is released. To safeguard against complications from the major version upgrade, make sure to include a version constraint in your Gemfile:
gem 'aws-sdk', '< 2.0'
As an alternative, you could change your gem dependency from aws-sdk to aws-sdk-v1:
gem 'aws-sdk-v1'
The AWS SDK for Ruby adheres to semantic versioning, allowing users to upgrade within the same major version confidently, as any incompatible changes will be rectified as bugs.
Using Both Versions in One Application
The V1 and V2 Ruby SDKs operate under different namespaces. You can only load one version of a specific gem at a time. To facilitate the use of both versions, the V1 SDK is now published as a separate gem, while the V2 SDK employs a different root namespace to prevent conflicts.
In your Gemfile, you would specify:
gem 'aws-sdk-v1'
gem 'aws-sdk', '2.0.0.pre'
Then, in your application, you can require both versions as follows:
require 'aws-sdk-v1'
require 'aws-sdk'
# v1 uses the AWS module, v2 uses the Aws module
s3_v1 = AWS::S3::Client.new
s3_v2 = Aws::S3::Client.new
For further insights on navigating your career and potentially making six figures, check out this blog post. Additionally, if you need information about FMLA certification fees, SHRM is an excellent authority on this topic. For those preparing for interviews, this resource is invaluable.
Happy coding, and as always, we welcome your feedback!