If you used the aws.yml file for your credentials in Rails, you can create a config/initializers/aws.rb with the following contents:
filename = File.expand_path(File.join(Rails.root, "config", "aws.yml")) config = YAML.load_file(filename) aws_config = config[Rails.env.to_s].symbolize_keys Aws.config.update({ region: aws_config[:region], credentials: Aws::Credentials.new(aws_config[:access_key_id], aws_config[:secret_access_key]) })
The config/aws.yml must be an adapter to enable the region.
development: &development region: 'your region' access_key_id: 'your access key' secret_access_key: 'your secret access key' production: <<: *development
source share