[RUBY] Knowledge required to bring Rails apps to AWS

Introduction

The author, who has no programming experience, has summarized the minimum knowledge required to bring a Rails application to AWS.

The summarized contents are as follows. ・ AWS ・ VPC ・ EC2 ・ RDS

AWS network services

image.png Reference: What is the Availability Zone

First of all, about the AWS network. The first thing to mention when using AWS is the ** Region ** and ** Availability Zone (AZ) **.

region

** Region ** refers to the location (country and region) where AWS provides services. If you use a distant region, network delay may occur, so basically use the Tokyo region.

Availability Zone (AZ)

** Availability Zone (AZ) ** Data Center (Provides a place to install and accommodate IT equipment such as server machines However, it is almost the same as a facility that provides various services for stable operation. AZs are prepared for each region, and four AZs are prepared in the Tokyo region.

AWS recommends using multiple AZs (multi-AZ configuration). With a multi-AZ configuration, if one AZ fails, you can avoid network failures by using another AZ.

Next, I will explain about AWS services.

VPC(Virtual Private Cloud) image.png

See: VPC and Subnets

VPC is a service that creates a network. Create a VPC network inside the AWS network as shown above. And VPCs can be split by creating subnets.

Roughly speaking It's an image of a large box (AWS) with a reasonably large box (VPC) and a small box (subnet) inside.

Then, EC2 and RDS, which will be explained below, will be placed in this small box (subnet).

EC2(Elastic Compute Cloud) image.png

Reference: How to start an instance

EC2 is a service that can use ** virtual server (instance) **, ** firewall (security group) **, etc.

A word you don't know came out ...

I will explain it roughly.

instance

The instance corresponds to the server of the conventional on-premises environment.

The instance has information such as OS, CPU, and memory.

In other words, "creating an instance" means ** "Select the conditions such as OS, CPU, memory, etc. and create the server you want" **.

Security group

Security groups are a standard AWS firewall feature. You can grant access to your EC2 instances and control traffic.

** By default, all communication is blocked. (important)** Therefore, it is necessary to allow specific communication.

Access permissions are divided according to the direction of communication, and are divided into ** inbound ** and ** outbound **. ** Inbound **: Allow communication from outside to instance (outside → instance) ** Outbound **: Allow communication from instance to outside (instance → outside)

I think this security group is the most error-prone part for beginners when dealing with AWS.

Make sure you understand that security groups are essential for linking multiple services.

RDS(Relational Datebase Service) image.png

Reference: Scenario for accessing a DB instance in VPC (official)

RDS is a service that allows you to use Relational Database (RDBMS) on the cloud.

There are two ways to use an RDBMS on AWS. (important)

** 1. How to install an RDBMS on an EC2 instance ** ** 2. How to use RDS **

In RDS, an instance (virtual server) for the database is created, and the OS and database engine are built on it. Therefore, the user does not need to maintain the server or middleware.

Basically, using RDS can reduce the cost of construction and operation, so when operating RDBMS, RDS is often selected.

Summary

It's pretty rough, but I've summarized my knowledge about AWS.

If you actually touch AWS while referring to the following articles, you will deepen your understanding of the details.

reference

The most polite AWS commentary in the world. Until you bring your Rails app to AWS using EC2

[Carefully explained with images] How to upload Rails application to AWS (EC2) from scratch [Part 1 ~ Network, RDS environment setting ~]

Recommended Posts

Knowledge required to bring Rails apps to AWS
Knowledge required to display tweets
Migrate existing Rails 6 apps to Docker environment
[Personal memo] Summary of stumbling blocks when deploying Rails apps to AWS
Introducing New Relic to Rails apps on Heroku
Deploy Rails to ECS Fargate with AWS Copilot
Recipe for deploying Rails apps on AWS EC2
Summary of knowledge required to pass Java SE8 Silver
How to download images from AWS S3 (rails, carrierwave)
How to write Rails
Introducing CircleCI to Rails
Introducing Bootstrap to Rails 5
Introduce Vue.js to Rails
How to uninstall Rails
How to deploy a Rails application on AWS (article summary)