Article Image
Article Image
View All Posts
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

This is the second post in a series of blog posts that describe how to deploy a Rails application to Elastic Beanstalk in a Virtual Private Cloud (VPC) on Amazon AWS.

In the previous post we configured a new VPC with public and private subnets along with security groups for our servers.

In this post we’ll setup a new Elastic Beanstalk application and deploy it in our VPC.

We’ll be setting up a Rails application for this example and initially we’ll just deploy the sample application.

The first thing we’ll do is create the Elastic Beanstalk application and pick Ruby as our platform:

Create a Ruby Application and Deploy Sample Application

We then click the “Configure More Options” button so we can control the setup in more detail. The first thing that we want to configure is platform configuration:

Change Platform Configuration

I going to be deploying a Rails 5 application that uses Puma - so I want to make sure Elastic Beanstalk matches my local configuration:

Select Puma and Ruby 2.3.3

We want to use an Elastic Load Balancer to expose our Application to the internet - a quick way to get the basics for this configured is to select the “High Availability” radio box and then customise the defaults that gives you.

The main settings we will need to change are on the “Network” card. On this card we pick the VPC that we want to deploy our application to and set our Load Balancer to publicly visible:

Deploy to our new VPC

We can then select the subnets that we want our Load Balancer to run in. For our deployment this should be the public subnets we created in step 1.

Select Public Subnets for Load Balancer

For our instances, we want these placed in our private subnets and we don’t want to assign a public IP address to them. All access to our instances will be via the Load Balancer so these machines definitely don’t need to be publicly accessible.

Select Private Subnets for Instances

Finally we want to set the security group for our instances. In our case this will be the “Web Server” security group. This security group does not actually open any ports on our instances. What it does provide is access to our database security group. Under the hood, when instances are added to our load balancer an additional security group is added automatically that allows access to ports 80/443 from the load balancer.

Choose instance security group

For the database card - we leave this blank so that we can create a database instance independently from our elastic beanstalk environment. This gives us a bit more flexibility on the lifetimes of our Elastic Beanstalk and our RDS instances (you may want to terminate an Elastic Beanstalk application but re-use your RDS instance).

Assuming all goes well, once the environment has launched you should see the sample application up and running on Elastic Beanstalk.

Sample Application up and Running


Related Posts

Step 1 - Setup VPC: Deploying a Rails Application to Elastic Beanstalk - Step-by-step guide to deploying a Rails application to Elastic Beanstalk in a Virtual Private Cloud (VPC) on Amazon AWS, including setting up the VPC, security groups, and gateways.
Step 4: Deploy Rails App To Elastic Beanstalk from Command Line - Create and deploy a new Rails application to AWS Elastic Beanstalk, scaffold a model, connect to an Amazon RDS database, and modify environment variables for production deployment.
Step 5: Use CircleCI to Deploy To Elastic Beanstalk - Follow this simple tutorial to set up CircleCI for automatic deployment of a Rails application to Elastic Beanstalk when code is pushed to GitHub, and observe how CircleCI picks up changes and deploys straight out to your development and production environment.
Step 6: Add a Custom Domain and SSL to Elastic Beanstalk - Efficiently configure a custom domain with SSL using Elastic Beanstalk for a secure and easy Rails application deployment.
Step 7: Action Cable on Elastic Beanstalk - Step-by-step guide on deploying a Rails 5 chat app with Action Cable on AWS Elastic Beanstalk, enabling real-time communication using WebSockets and configuring the nginx server.

Related Videos

TensorFlow Lite With and the ESP32 - Master the process of training a TensorFlow Lite model and deploying it on the ESP32 using PlatformIO with this comprehensive tutorial, complete with clear instructions and an informative video.
3D Printed Game Controller Designed in Fusion 360 - Master the art of designing and building your own game controller with 3D printing, Fusion 360, and ESP32 components in this comprehensive tutorial.
The Hacker News Effect - The Website Didn't Catch Fire - Let's look at the traffic - Experience the Hacker News effect firsthand with a blog that soared to 45,000 requests in a day, managing the load seamlessly with Amazon AWS, Cloudfront, and Jekyll static site generation.
Build your own Alexa with the ESP32 and TensorFlow Lite - Create an Alexa-styled voice assistant using TensorFlow Lite, ESP32, and, with a detailed explanation of wake word detection, audio capture, and intent recognition
Raspberry Pi Hidden Settings - Setup Hostname, SSH and WiFi from the Pi Imager Application. - Easily set up SSH, WiFi, and hostnames for your Raspberry Pi by accessing a hidden screen within the Imager Application. Press Ctrl+Shift+X to reveal this convenient feature.
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening


> Image


A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts