[Ruby] A high bill from AWS during development with rails…

2 minute read

There is a free usage tier of 750 hours/month in EC2, and a free instance size of db.t2.micro in RDS, but there is a big pitfall in this (it fell nicely…). 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 = total usage time. In my case I was running two EC2s. Fortunately, I wasn’t billed because I noticed it in about half a month, but it was dangerous. I hurriedly stopped both and started it only during development.

In the case of RDS, you can freely choose the instance size (which is configured by the combination of CPU, memory, storage and network capacity), and db.t2.micro exists as a free tier. This is the lowest level, and the price increases in proportion to the performance. In my case, the instance size db.m5.xlarge was selected (the cause is unknown…), and I was charged about 500$ in one month. .. .. .. .. **

Immediately trying to change the DB instance to db.m5.xlarge ➡️ db.t2.micro, but the following error occurred. 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 encryption at rest, so it can’t be changed. I tried to encrypt with reference to the following, but I gave up because the encryption button was not effective. https://dev.classmethod.jp/articles/encrypt-unencrypted-rds-db-instance-ja/

Even if you give up the free tier db.t2.micro, the next configuration, db.t2.small, can be changed. db.m5.xlarge ➡️ We made a change to db.t2.small and succeeded in significantly reducing the usage fee.

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

Besides the above, please pay attention to the following settings. The storage type can be selected from the following three types, which also came with a high bill of $150. .. .. General Purpose (SSD) Provisioned IOPS(SSD) ⬅️ Initial selection magnetic The setting was changed as follows with reference to the following article https://blog.manabusakai.com/2015/07/rds-cost-down/ Provisioned IOPS (SSD) ➡️ Be careful when changing general purpose (SSD) (loading time may be long)

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 more quickly. .. .. 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

There are also the following types of fees that beginners fall into. https://qiita.com/Yuji-Ishibashi/items/bb1c0042fd16a9350c5a Furthermore, it seems that if you make a mistake in the settings, you will get the following super-high-price bills. https://qiita.com/mochizukikotaro/items/a0e98ff0063a77e7b694

Finally, I hope this article can help you with a bit as expensive as I am.