[RUBY] A high bill from AWS during development on rails ...

There is a free tier of 750 hours / month on EC2 and a free instance size of db.t2.micro on RDS, but there is a big pitfall in this (it fell brilliantly ...). Actually, EC2 instance and RDS instance size

The idea of EC2 is that the number of creations X usage time = total usage time. Free usage limit = total usage time. In my case, I was running two EC2s. Fortunately, I noticed it about half a month, so I wasn't charged, but it was dangerous. I hurriedly executed both stops and started only during development.

In the case of RDS, you can freely select the instance size (consisting of a combination of CPU, memory, storage, and network capacity), and db.t2.micro exists as a free usage tier. This is the lowest level, and the price goes up in proportion to the performance. In my case, the instance size db.m5.xlarge was selected (cause unknown ...) and I was charged nearly $ 500 in a month. .. .. .. .. ** **

Immediately try to change the corresponding DB instance to db.m5.xlarge ➡️ db.t2.micro, but the following error occurs. DB Instance class db.t2.micro does not support encryption at rest (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: cfbf5c05-7c57-492b-b9e3-6145a6f2c640)

Apparently, db.t2.micro doesn't support save encryption so you can't change it. I tried encryption by referring to the following, but the encryption button did not work and I gave up. https://dev.classmethod.jp/articles/encrypt-unencrypted-rds-db-instance-ja/

Even if you give up on the free frame db.t2.micro, it seems that you can change it with the next configuration, db.t2.small. We made a change to db.m5.xlarge ➡️ db.t2.small and succeeded in significantly reducing the usage fee.

When using AWS from the next time, setting up an application server on the EC2 container, and building the DB with RDS, How many EC2s are moving and how long is the total usage time? `` Is the RDS instance size a free tier, db.t2.micro (or something close to it)? `` I want to always check and use these two points.

In addition to the above, pay attention to the following settings. You can choose from the following three storage types, which also received a high charge of $ 150. .. .. General purpose (SSD) Provisioned IOPS (SSD) ⬅️ Initial selection Magnetic I changed the settings as follows with reference to the following article https://blog.manabusakai.com/2015/07/rds-cost-down/ Provisioned IOPS (SSD) ➡️ General purpose (SSD) Be careful when changing (load time may be longer)

The actual billing statement has the following description, and if the reference article is correct, the cost will be reduced by $ 146.67. I wanted to know earlier. .. .. USD 0.24 per IOPS-month of Multi-AZ Provisioned IOPS611.111 IOPS-Mo$146.67 USD 0.30 per GB-month of provisioned Multi-AZ IO1 storage61.111 GB-Mo$18.33

In addition, it seems that there are the following charges that beginners fall into. https://qiita.com/Yuji-Ishibashi/items/bb1c0042fd16a9350c5a Furthermore, if you make a mistake in the settings, you will be charged the following super-high amount. https://qiita.com/mochizukikotaro/items/a0e98ff0063a77e7b694

Finally, I just hope that this article will help you with the same high bills as I do.

Recommended Posts

A high bill from AWS during development on rails ...
I was charged a lot by AWS during development on rails, but ...
Build a Ruby on Rails development environment on AWS Cloud9
Post a video on rails
How to deploy a Rails application on AWS (article summary)
Build a Minecraft server on AWS
Build a development environment where Ruby on Rails breakpoints work on Windows
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
Steps to build a Ruby on Rails development environment with Vagrant
Change from SQLite3 to PostgreSQL in a new Ruby on Rails project
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
Build a development environment on AWS EC2 with CentOS7 + Nginx + pm2 + Nuxt.js
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Try deploying a Rails app on EC2-Part 1-
[Rails] Use validation on a specific controller
Build a Maven repository on AWS S3
[Ruby] Building a Ruby development environment on Ubuntu
Build a Java development environment on Mac
Build Java 8 development environment on AWS Cloud9
Build a development environment for Docker + Rails6 + Postgresql
How to deploy a container on AWS Lambda
Introducing Rspec, a Ruby on Rails test framework
[Ruby on Rails] A memorandum of layout templates
Build a Laravel environment on an AWS instance
Ruby on Rails development environment construction on M1 Mac
Recipe for deploying Rails apps on AWS EC2
I made a portfolio with Ruby On Rails
A memo when building a Rails 5.2 development environment using Docker Desktop + WSL2 on Windows 10 Home
[Ruby on rails + Mysql] Data migration procedure memo when switching from heroku to AWS
[Ruby On Rails] De-root_path! Redirect notation from a nested "child" view to a nested "parent": show