Release: AWS SDK for Ruby 1.3.3

Release Notes>Ruby>Release: AWS SDK for Ruby 1.3.3
This release adds support for AWS Identity and Access Management virtual MFA devices, Amazon Simple Notification Service delivery policies, Amazon S3 object expiration and a few other AWS::S3 updates.

Details

Submitted By: trevor@AWS
Release Date: February 2, 2012 6:50 PM GMT
Latest Version: 1.3.3
Created On: February 2, 2012 6:50 PM GMT
Last Updated: February 2, 2012 6:50 PM GMT

Latest Version

Download the latest version of the AWS SDK for Ruby:

gem install aws-sdk

New Features

Change Description
AWS Identity and Access Management Virtual MFA Device Support

You can now create and enable virtual MFA devices using AWS::IAM.

require 'rotp'

iam = AWS::IAM.new
user = iam.users.create('user-1')
device = iam.virtual_mfa_devices.create('device-1')

totp = ROTP::TOTP.new(device.base_32_string_seed)
token1 = totp.now
sleep(30) # wait for a 2nd code
token2 = totp.now

device.enable(user, token1, token2)
Amazon Simple Notification Service Delivery Policies

You can now set delivery policies on Amazon SNS topics and subscriptions.

sns = AWS::SNS.new
topic = sns.topics.first

# set a delivery policy
topic.delivery_policy = {
  "http" => {
    "disableSubscriptionOverrides" => true,
    "defaultHealthyRetryPolicy" => {
      "minDelayTarget" => 20,
      "numRetries" => 3,
      "numNoDelayRetries" => 0,
      "backoffFunction" => "linear",
      "numMaxDelayRetries" => 0,
      "numMinDelayRetries" => 0,
      "maxDelayTarget" => 20
    }
  }
}

# get the policy set on this topic 
topic.delivery_policy #=> { ... }

# get the effective policy that accounts for defaults provided by the service
topic.effective_delivery_policy #=> { ... }
Amazon S3 Object Expiration

You can now set a bucket lifecycle configuration that allows you to schedule the deletion of objects after a period of time.

s3 = AWS::S3.new

# create a bucket and add a few rules for object deletion
bucket = s3.buckets.create('test-bucket-with-expiry')
bucket.lifecycle_configuration.update do
  add_rule 'tmp/', 30 # delete files prefixed with 'tmp/' after 30 days
  add_rule 'cache/', 1 # delete files prefixed with 'cache/' after 1 day
end

# write an object that will have a baked in expiration
object = bucket.objects['tmp/greeting.txt'].write('Hello World!')
object.expiration_date #=>  #

# remove one of the rules
bucket.lifecycle_configuration.remove_rule object.expiration_rule_id
AWS::S3::Bucket#clear!

You can now empty all objects from a bucket (including versioned objects) by calling #clear! on a bucket.

s3 = AWS::S3.new
s3.buckets['my-bucket'].clear!
AWS::S3::S3Object#move_to

You can now rename an object within a bucket or move it to a new bucket with S3Object#move_to. The #move_to method works by making a copy of the object to the new location and then deleting the object from the old location.

s3 = AWS::S3.new
# rename the object
s3.buckets['my-bucket'].objects['foo].move_to('bar')

# move it to a different bucket
s3.buckets['my-bucket'].objects['bar].move_to('bar', :bucket_name => 'other-bucket')

If the copy fails the delete will not follow and an error will be raised.

Presigned URLS for object versions in Amazon S3

Added AWS::S3::ObjectVersion#url_for which behaves like AWS::S3::S3Object#url_for. You can also now pass :version_id to S3Object#url_for.

s3 = AWS::S3.new
s3.buckets['my-versioned-bucket'].objects['foo].versions.each do |v|
  puts v.url_for(:read)
end
AWS::Record::Model#destory

The delete method has been aliased to destroy to be more like ActiveModel.

AWS.config.ssl_ca_path

You can now configure a path to a CA cert directory. This is useful if your distribution does not provide a CA cert bundle.

AWS.config(:ssl_ca_path => '/...')

Resolved Issues

Change Description
AWS::STS Documentation Fix

A documentation example for AWS::STS was corrected and the documentation for working with object versions for AWS::S3 was expanded.

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
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.