[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (3)

This is the way to build a production environment on AWS by turning a Ruby on Rails application created as a portfolio into a Docker container. The portfolio itself is here. [[Portfolio] Overview of the portfolio created during job change activities (Tec camp)] (https://qiita.com/sho_U/items/058e590325ee6833abb0)

I was suffering a lot, so I hope it helps someone.

title
1 Docker containerization of Rails application in local environment
2 Create a VPC on AWS. Create a public subnet
3 Create a private subnet
4 Create an EC2 instance
5 Create an RDS
6 Upload Docker container to AWS

Create a private subnet.

Actually, I will explain the reason later, but you need to create two private subnets in different Availability Zones. The Availability Zone is, roughly speaking, the area where the server where the cloud is stored is actually located.

Therefore, make the following configuration.

IMG_633C134D7C4A-1.jpeg

Create the first private subnet.

Enter the VPC dashboard from the AWS console, select a subnet and create a subnet.

Select the VPC you created earlier for your VPC ID.

Availability Zone: This time ap-northease-1a

Name: fitO2_private_subnet_1a

IPv4 CIDR block: 10.0.20.0/24

Click "Create Subnet"

Create a second private subnet.

Enter the VPC dashboard from the AWS console, select a subnet and create a subnet.

Select the VPC you created earlier for your VPC ID.

Availability Zone: This time ap-northease-1c

Name: fitO2_private_subnet_1c

IPv4 CIDR block: 10.0.21.0/24

Click "Create Subnet"

Create a security group for your private subnet.

Click a security group on your EC2 dashboard, then click Create Security Group.

image.png

Click Add Rule.

Security group name: fitO2_db_SG VPC: The VPC you just created Inbound : Type: MYSQL/Aurora Port: 3306 Source : custom Specify the security group (created earlier) that you plan to apply to EC2 instances located in the public subnet. (If you type in the name, it will come out. If it does not come out, copy and paste the group ID)

This completes the creation of the two private subnets and the security groups shown below that you plan to apply to them.

IMG_237B88A63A89-1.jpeg

Continue to next time (4) Create an EC2 instance |

Recommended Posts

[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (5)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (6)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (3)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (2)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (1)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (4)
Build an environment with Docker on AWS
Build Metabase with Docker on Lightsail and make it https with nginx
Deploy to heroku with Docker (Rails 6, MySQL)
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Ruby on Rails ✕ Docker ✕ MySQL Introducing Docker and docker-compose to apps under development
Introducing Rspec with Ruby on Rails x Docker
[Ruby on Rails] Let's build an environment on mac
[Rails] How to build an environment with Docker
Building an environment for WordPress, MySQL and phpMyAdmin with Docker Compose on EC2
Rails deploy with Docker
Build a Ruby on Rails development environment on AWS Cloud9
Rails6 I tried to introduce Docker to an existing application
Build Rails (API) x MySQL x Nuxt.js environment with Docker
Build WordPress environment with Docker (Local) and AWS (Production)
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
Maybe it works! Create an image with Docker and share it!
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
Java: Start WAS with Docker and deploy your own application
How to deploy a Rails application on AWS (article summary)
Rails + MySQL environment construction with Docker
Deploy a Docker application with Greengrass
[Docker] How to back up and restore the DB data of Rails application on docker-compose [MySQL]
Ruby on Rails development environment construction with Docker + VSCode (Remote Container)
How to make an application with ruby on rails (assuming that the environment has been built)
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
Build Rails environment with Docker Compose
[Environment construction with Docker] Rails 6 & MySQL 8
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
Deploy Rails on Docker to heroku
Steps to build a Ruby on Rails development environment with Vagrant
Build a web application development environment that uses Java, MySQL, and Redis with Docker CE for Windows
Build debug environment on container --Build local development environment for Rails tutorial with Docker-
I built a rails environment with docker and mysql, but I got stuck
How to build a Ruby on Rails environment using Docker (for Docker beginners)
Getting Started with Micronaut 2.x ~ Native Build and Deploy to AWS Lambda ~
Template: Build a Ruby / Rails development environment with a Docker container (Ubuntu version)
Template: Build a Ruby / Rails development environment with a Docker container (Mac version)
[Ruby on Rails] View test with RSpec
Building Rails 6 and PostgreSQL environment with Docker
Deploy heroku with Rails6 (Cloud9 + Ubuntu) + MySQL
Create Rails 6 + MySQL environment with Docker compose
[Ruby on Rails] Controller test with RSpec
Deploy to Heroku [Ruby on Rails] Beginner
Ruby on Rails application new creation command
[Ruby on Rails] Model test with RSpec
Deploy your application with VPC + EC2 + Docker.
Build an Ultra96v2 development environment on Docker 1
How to build Rails 6 environment with Docker
Introduce Docker to the development environment and test environment of existing Rails and MySQL applications
A memorandum when building an environment with Ruby3.0 x Rails6.1 x Docker x CentOS Stream
Run Docker environment Rails MySQL on Heroku. devise and hiding the twitter API
How to build an environment of [TypeScript + Vue + Express + MySQL] with Docker ~ Vue edition ~
Build a development environment to create Ruby on Jets + React apps with Docker
Downgrade an existing app created with rails 5.2.4 to 5.1.6