AWS Aurora / RDS Questions

Hey there! I’m working on a small web site partially for fun, partially as a portfolio project.

I’m running the site in a Docker Container on an ECS Cluster, and having it communicate with a MySQL database I’ve launched on an Aurora Instance. I launched this setup 11 days ago, but haven’t shared the site as it’s still in development, and got an unexpected bill today for ~280 bucks - the majority of which was $1 per instance hour used on my Aurora instance.

I already reduced the instance size (db.r6g.2xlarge → db.r5.large), and changed the database to I/O optimized, but I’m unsure if those would reduce the cost enough - this is a hobby project, so I’d really like to keep the cost under 100/month. I remain a little confused regarding a few Aurora/RDS things.

On the pricing page, the only examples I see where there is a price per instance hour are examples with Aurora Global - I don’t know where I opted in to Aurora Global, nor can I find where on my manage database page it says whether the instance is Aurora Global, or how to change that.

Are there other options or pages I’m missing? Should I use a different AWS RDS service? Some pointers would be greatly appreciated.

EDIT: Thanks all for the insight and examples. I’ve turned down instance size to T4g.medium for the moment, that seems more appropriate for my use case (I intend to launch in the next week or so, and the site might receive some viral attention as a fansite for a popular video game). I’m also investigating more Aurora server less. I appreciate all the guidance as I’m still very new to all this!

Use the serverless version of aurora MySQL. Saves you a lot if its just a pet project that doesn’t require keeping the database alive everytime except when you’re using your site or app

It seems that the unexpected bill for the Aurora instance is due to the hourly cost of the instance. i believe you already has reduced the instance size and changed the database to I/O optimized, but is unsure if those changes would reduce the cost enough. pardon me but i think you also confused about Aurora Global and where to find information about it. Here are some pointers that might help:

  • Aurora Global is a feature that allows you to create a global database that spans multiple AWS regions. It is not clear if you has opted in to this feature, but it is not necessary for a single-region setup[1].

  • The hourly cost of an Aurora instance depends on the instance type and the region it is deployed in. You can check the pricing page for more information on the hourly cost of different instance types in different regions[1].

  • If you are looking for a more cost-effective solution, you could consider using Amazon RDS instead of Aurora. RDS is a managed database service that is similar to Aurora, but is generally less expensive. However, RDS does not have all the features of Aurora, such as the ability to create read replicas across regions[1].

  • It is also worth noting that you could consider using Amazon DynamoDB instead of a relational database like Aurora or RDS. DynamoDB is a NoSQL database that is designed to be highly scalable and can be more cost-effective for certain workloads[1].

In terms of your specific setup, it seems that you are running a Docker container on an ECS cluster and communicating with a MySQL database on an Aurora instance. Here are some search results that might be helpful for this setup:

  • This discussion thread includes a question about running a serverless application on AWS with a MySQL database. The recommended solution is to use Amazon RDS, which is a managed database service that can be used with serverless applications[1].

  • This AWS re:Post thread discusses connecting a Docker container to an Aurora MySQL database in RDS. You were able to connect to Aurora and Aurora Serverless MySQL running in a VPC with no public access[2].

  • This Stack Overflow thread discusses an issue with connecting an ECS task to an RDS MySQL database. you were able to create a Docker container that runs an R script that connects to an AWS RDS MySQL database and creates and writes some basic data[3].

  • This GitHub issue discusses an issue with connecting to an Aurora MySQL database with an ECS Fargate container. The user was able to connect to one of the database clusters using the writer endpoint

Overall, it seems that you have several options for reducing the cost of their Aurora instance, including switching to Amazon RDS or DynamoDB, or optimizing their Aurora instance further. You can also check the pricing page for more information on the hourly cost of different instance types in different regions.

Sources

[1] Exam AWS Certified Solutions Architect - Professional topic 1 question 680 discussion https://www.examtopics.com/discussions/amazon/view/36444-exam-aws-certified-solutions-architect-professional-topic-1/

[2] we have a requirement to connect docker to aurora mysql in rds | AWS re:Post https://repost.aws/questions/QUCN_fguClRcKDS67U_n3N4A/we-have-a-requirement-to-connect-docker-to-aurora-mysql-in-rds

[3] AWS ECS Task can’t connect to RDS Database - Stack Overflow https://stackoverflow.com/questions/67223885/aws-ecs-task-cant-connect-to-rds-database

[4] Unable to connect to Aurora MySql with Aws ECS fargate container · Issue #76 · awslabs/rds-support-tools - GitHub https://github.com/awslabs/rds-support-tools/issues/76

Hard to say without your bill.
Try to create an Aurora serverless node and limit the ACU to the least minimum.

Have a look on here at the RDS DB sizing, r6g.2xlarge is quite big for a small website/portfolio.

Once we know more about your data access patterns, we can give you some advice on how to optimise your architecture.

R6g.2xlarge is a massive instance for a hobby project.

https://aws.amazon.com/rds/aurora/pricing/

Gotcha! I had already downgraded to a db.r5.large before I posted, but I’ve now changed to db.t4g.medium. That seems more appropriate for my scope, thanks

In addition to storage and I/O, all RDS instances are billed by instance hour. The only exception is serverless.

If it’s a hobby project with an unlaunched site, why on earth are you using an r5.large instance? We have a platform that have hundreds of thousands of daily users, and we use r6g.large, but even that’s a bit overkill (granted we use a lot of caching mechanisms, but still).

In your case you could probably get away with using a t3.micro instance. AWS have made it really easy to change instance type, just a few clicks in the console. If you run it in a 2-instance writer/reader configuration, you can even do it without downtime (though I definitely would’t do that as long as the site is unlaunched).

If you barely have users make it the smallest possible for now.

For a hobby project, unless you’re doing something particularly database heavy, that’s massively overkill.

We run our work internal environments on micro instances, a medium instance would serve a genuine production web app

For a hobby project in development state, I’d check aurora serverless.

Use the smallest instance possible. Use single AZ. Do not use RDS proxy.

Maybe you can also use Aurrora Serverless and have it shut down after some period of inactivity. It might be the best approach for your use case.

Can you use Serverless? An idle Serverless V2 at 0.5 vCPU costs about $40/month.

Whats annoying is Aurora Serverless V1 would let you scale down to 0 but V2 does not, so its always running. Its one of my biggest costs my company has to foot because each environment gets a database usually.

I think you can still start a V1 instance, but they suggest you not use it. Maybe for just development though it might be good.

Honestly I’m running 10 small client websites on a self hosted MySQL on a t4g.nano instance.

I wouldn’t necessarily recommend that, but your config is way overpowered.

Is the application talking to this db built in a way to use the Aurora reader and writer endpoints appropriately? Asking because a right-sized vanilla RDS is a beast that might serve your use case and provide your wallet some breathing room.

Understood! I do intend to go to production, and there’s a chance this site gets some actual traffic (it’s a fansite for a popular video game) so I’ll stick with T4g.medium for the moment. I appreciate the insight.

Would you mind clarifying what ‘Alive’ means? I assume it doesn’t totally wipe the database, so does it ‘hibernate’ and have to take a moment to spin back up when requested? Would that have a noticeable effect for users?

Would that still be a good approach if they were a few users from most time zones using the site at any given time?

TBH I wasn’t super familiar with the options, or the relevant metrics, so I just picked one. Paid my tuition for that mistake!

Your example is really great, I didn’t realize the sheer scale of some of these options. I’ve already downgraded my instance size further.

Edit: When I modify select Burstable Classes, the smallest instance that it lists as an option is T3.medium? Why might that be the case, how could I modify to even smaller sizes?