Monthly Archives: May 2014

RDS Instance Sizes, maximum concurrent connections

Historical default max_connections limits across first-generation Amazon RDS MySQL instance classes:

RDS Instance ClassDefault max_connections
db.t1.micro34
db.m1.small125
db.m1.medium296
db.m1.large623
db.m1.xlarge1,263
db.m2.xlarge1,441
db.m2.2xlarge2,900
db.m2.4xlarge5,816

In RDS Parameter Groups, the dynamic formula defaults to {DBInstanceClassMemory/12582880} for MySQL and LEAST({DBInstanceClassMemory/9531392}, 5000) for PostgreSQL. On modern instance families (such as db.t3 and Graviton db.t4g), pooling connections with Amazon RDS Proxy prevents connection exhaustion from serverless or autoscaling workloads.

Amazon Relational Database Service (RDS) database icon

How to waste less money with AWS

First of all, you need to carefully select the region where you are going to establish your servers.

US-EAST / US-WEST-2 were the cheapest regions at the time I wrote this.

You can check the prices per region in the links at the end of this post.

Amazon Web Services cloud platform logo

While using AWS for almost a year on the Free Tier, I didn’t pay attention to instance purchasing options.

Choosing the right AWS region alongside Reserved capacity, Savings Plans, Spot Instances for fault-tolerant jobs, and ARM64 AWS Graviton instance families can cut monthly compute bills significantly without sacrificing reliability.

Pricing references: Amazon EC2 Pricing | EC2 Purchasing Options

How to change the timezone in Ubuntu

Ubuntu terminal screen showing dpkg-reconfigure tzdata timezone selection for America/Sao_Paulo

To change the timezone interactively in Ubuntu, run:

sudo dpkg-reconfigure tzdata

On modern systemd-based Ubuntu releases, you can also set it non-interactively with timedatectl:

sudo timedatectl set-timezone America/Sao_Paulo
timedatectl status

How to survive with an AWS EC2 t1.micro instance

amazon-ec2

With my t1.micro, I can host my personal Redmine, Git, and blog, which I couldn’t do with the default settings.

I used a swap file for it, and here is how you can set it up:

Copy & paste the code below:

sudo dd if=/dev/zero of=/var/swapfile bs=1M count=2048 status=progress
sudo chown root:root /var/swapfile
sudo chmod 0600 /var/swapfile
sudo mkswap /var/swapfile
sudo swapon /var/swapfile
echo '/var/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

To disable it cleanly later, run:

sudo swapoff -v /var/swapfile
sudo rm /var/swapfile
sudo sed -i '\|/var/swapfile|d' /etc/fstab

Alongside swap, keeping a tiny VM responsive came down to caching and restraint: placing Varnish in front of Apache absorbed static/anonymous reads before spawning memory-heavy worker processes, while PHP bytecode caching (APC back then, replaced natively by PHP OPcache today) avoided recompiling scripts on every request.

Cloud & Modern Linux Caveats: Heavy swapping on network-attached EBS volumes adds latency and burns through storage IOPS burst credits, so keep vm.swappiness=10 and treat swap strictly as an OOM safety net. On modern Linux kernels, compressed in-memory swap with zram is much faster and avoids unnecessary disk writes, while older tools like prelink are deprecated because of ASLR.