Announcing the aws-sdk-rails Gem
With the release of V2 of the AWS SDK for Ruby, we’ve received customer feedback asking for support for the Ruby on Rails integration features provided by V1 of the SDK.
To get started, add the
gem to your Gemfile:
gem 'aws-sdk-rails', '~> 1.0'
ActionMailer and Amazon Simple Email Service (SES)
The gem will automatically configure Rails to include an
delivery method for ActionMailer, that uses Amazon SES as a backend. It is simple to configure Rails to use this delivery method:
# config/application.rb config.action_mailer.delivery_method = :aws_sdk
The aws-sdk-rails gem will use the AWS SDK for Ruby V2’s SES client automatically for any mail delivery event.
The gem will automatically wire the AWS SDK for Ruby’s logger to use
You can customize the SDK log level and an optional log formatter in a config initializer:
# config/initializers/aws-sdk.rb # log level defaults to :info Aws.config[:log_level] = :debug
It is important to understand that
all SDK log messages are logged at the same log level
. Why is this important? When you set the Rails log level, you’re muting all log messages below that log level. So, if you want to, for example, only see SDK log messages in development, you might set the SDK log level to
as shown above, and set the Rails logger to show debug in development.
The AWS SDK for Ruby will attempt locate credentials by searching the following locations:
- The shared credentials ini file at ~/.aws/credentials
- From an instance profile when running on Amazon EC2
If you need to manually configure credentials, you should add them to your initializer:
# config/initializers/aws-sdk.rb Aws.config[:credentials] = Aws::Credentials.new(access_key, secret)
Never commit your credentials to source control. Besides being a security risk, it makes it very difficult to rotate your credentials.
gem is available now.
As always, we’d love to hear your feedback, and welcome any Issues or Pull Requests at the aws-sdk-rails GitHub repo .