AWS Elastic Beanstalk
Developer Guide
AWS services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon AWS.

Setting Up your Ruby Development Environment

Set up a Ruby development environment to test your application locally prior to deploying it to AWS 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, 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 environment for use with AWS 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.

~$ gpg --keyserver hkp://keys.gnupg.net --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.1[.10] [ruby-]2.2[.10] [ruby-]2.3[.7] [ruby-]2.4[.4] [ruby-]2.5[.1] ...

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

~$ rvm install 2.5.1 Searching for binary rubies, this might take some time. Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/16.04/x86_64/ruby-2.5.1.tar.bz2 Checking requirements for ubuntu. Requirements installation successful. ruby-2.5.1 - #configure ruby-2.5.1 - #download ...

Test your Ruby installation.

~$ ruby --version ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

Installing the AWS SDK for Ruby

If you need to manage AWS resources from within your application, install the AWS 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 AWS 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.