Setting up your Ruby development environment - Amazon Elastic Beanstalk
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Setting up your Ruby development environment

Set up a Ruby development environment to test your application locally prior to deploying it to Amazon Elastic Beanstalk. This topic outlines development environment setup steps and links to installation pages for useful tools.

To follow the procedures in this guide, you will need a command line terminal or shell to run commands. Commands are shown in listings preceded by a prompt symbol ($) and the name of the current directory, when appropriate.

~/eb-project$ this is a command this is output

On Linux and macOS, you can use your preferred shell and package manager. On Windows 10, you can install the Windows Subsystem for Linux to get a Windows-integrated version of Ubuntu and Bash.

For common setup steps and tools that apply to all languages, see Configuring your development machine for use with Elastic Beanstalk

Installing Ruby

Install GCC if you don't have a C compiler. On Ubuntu, use apt.

~$ sudo apt install gcc

On Amazon Linux, use yum.

~$ sudo yum install gcc

Install RVM to manage Ruby language installations on your machine. Use the commands at rvm.io to get the project keys and run the installation script.

~$ gpg2 --recv-keys key1 key2 ~$ curl -sSL https://get.rvm.io | bash -s stable

This script installs RVM in a folder named .rvm in your user directory, and modifies your shell profile to load a setup script whenever you open a new terminal. Load the script manually to get started.

~$ source ~/.rvm/scripts/rvm

Use rvm get head to get the latest version.

~$ rvm get head

View the available versions of Ruby.

~$ rvm list known # MRI Rubies ... [ruby-]2.6[.8] [ruby-]2.7[.4] [ruby-]3[.0.2] ...

Check Ruby in the Amazon Elastic Beanstalk Platforms document to find the latest version of Ruby available on an Elastic Beanstalk platform. Install that version.

~$ rvm install 3.0.2 Searching for binary rubies, this might take some time. Found remote file https://rubies.travis-ci.org/ubuntu/20.04/x86_64/ruby-3.0.2.tar.bz2 Checking requirements for ubuntu. Updating system.. ... Requirements installation successful. ruby-3.0.2 - #configure ruby-3.0.2 - #download ...

Test your Ruby installation.

~$ ruby --version ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

Installing the Amazon SDK for Ruby

If you need to manage Amazon resources from within your application, install the Amazon SDK for Ruby. For example, with the SDK for Ruby, you can use Amazon DynamoDB (DynamoDB) to store user and session information without creating a relational database.

Install the SDK for Ruby and its dependencies with the gem command.

$ gem install aws-sdk

Visit the Amazon SDK for Ruby homepage for more information and installation instructions.

Installing an IDE or text editor

Integrated development environments (IDEs) provide a wide range of features that facilitate application development. If you haven't used an IDE for Ruby development, try Aptana and RubyMine and see which works best for you.

Note

An IDE might add files to your project folder that you might not want to commit to source control. To prevent committing these files to source control, use .gitignore or your source control tool's equivalent.

If you just want to begin coding and don't need all of the features of an IDE, consider installing Sublime Text.