Member-only story

Leveraging AWS Services with Ruby on Rails 🚀

Lakhveer Singh Rajput
DevOps.dev
Published in
5 min readSep 5, 2024

Amazon Web Services (AWS) provides a comprehensive cloud computing platform that offers a wide range of services from computing power, storage, databases, and machine learning to advanced data analytics. Integrating AWS services with Ruby on Rails allows developers to build scalable, resilient, and cost-effective applications.

In this blog, we’ll dive deep into some commonly used AWS services with Ruby on Rails, highlighting their use cases and providing examples of how to integrate them into your Rails app. Let’s begin! 🔥

1. Amazon S3 (Simple Storage Service) 🗃️

Amazon S3 is a highly scalable object storage service that allows you to store and retrieve any amount of data at any time. For a Ruby on Rails app, S3 is typically used to store assets such as images, videos, and documents.

Integration with Ruby on Rails

First, add the `aws-sdk-s3` gem to your Gemfile:

gem 'aws-sdk-s3', '~> 1.96'

Next, create an initializer for AWS S3 in `config/initializers/aws_s3.rb`:

Aws.config.update({
region: 'us-west-2',
credentials: Aws::Credentials.new(
ENV['AWS_ACCESS_KEY_ID'],
ENV['AWS_SECRET_ACCESS_KEY']
)
})

S3_BUCKET = Aws::S3::Resource.new.bucket(ENV['S3_BUCKET_NAME'])

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in DevOps.dev

Devops.dev is a community of DevOps enthusiasts sharing insight, stories, and the latest development in the field.

Written by Lakhveer Singh Rajput

Ruby on Rails enthusiast, book lover and DevOps explorer. Follow me for insights on coding, book recommendations, and bridging development with operations.🚀📚

No responses yet

Write a response