Powerful Redmine in AWS

In this post I will show how to install Redmine on AWS using several useful AWS services (EC2, RDS, S3, SES, ElastiCache) and make it auto-scalable.

Historical Note (2014): This walkthrough originally targeted Ubuntu 14.04 LTS (PV), Ruby 2.x, and Redmine 2.5. Inline corrections below fix command typos, YAML indentation, Apache XML tags, and insecure defaults for anyone referencing the architecture today.

Redmine

Continue reading

Amazon SES: Simple Email Service

Amazon Simple Email Service (Amazon SES) is a highly scalable and cost-effective bulk and transactional email-sending service for businesses and developers. Sign-up is quick and on a pay-as-you-go basis. Amazon SES

Continue reading

How to use a different user and group for just one Virtual Host in Apache

apacheWith mpm-itk, a multi-processing module (MPM), you can run each VirtualHost with its own user ID and group ID. This is commonly used to secure shared hosting, since you don’t have to make every VirtualHost folder readable by the Apache user.

mpm-itk is based on the traditional prefork MPM, which means it’s non-threaded; in short, this means you can run non-thread-aware code (like many PHP extensions) without problems.

Continue reading

How to fix “Can’t locate Search/Xapian.pm in @INC”

perlError: Can’t locate Search/Xapian.pm in @INC (you may need to install the Search::Xapian module) (@INC contains: /path/to/something /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at (eval 143) line 2. BEGIN failed–compilation aborted at (eval 143) line 2.

To fix this on Ubuntu 14.04, just run:

sudo apt update && sudo apt install libsearch-xapian-perl

How to fix “Can’t locate Sort/Naturally.pm in @INC”

perlCan’t locate Sort/Naturally.pm in @INC (you may need to install the Sort::Naturally module) (@INC contains: /path/to/something /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at (eval 145) line 2.
BEGIN failed–compilation aborted at (eval 145) line 2.

To fix this on Ubuntu 14.04, just run:

sudo apt update && sudo apt install libsort-naturally-perl

How to disable Apache logs

apacheTo reduce disk writes or silence access logs on a local lab server, update your Apache configuration in /etc/apache2/ (note that Ubuntu/Debian Apache 2.4 uses conf-available/ and 000-default.conf instead of legacy conf.d/ and default):

1. Disable the global vhost access log config:

sudo a2disconf other-vhosts-access-log

2. Inside your VirtualHost files (/etc/apache2/sites-available/000-default.conf and default-ssl.conf), comment out CustomLog:

#CustomLog ${APACHE_LOG_DIR}/access.log combined

3. Validate and reload Apache:

sudo apache2ctl configtest && sudo systemctl reload apache2

Operational Warning: You can silence errors with ErrorLog /dev/null on disposable test VMs, but in staging or production keep ErrorLog active (or raise LogLevel warn) so crashes, permission failures, and TLS errors remain diagnosable.

Delete an Elastic Beanstalk bucket

If you can’t delete an Elastic Beanstalk-created bucket, first remove all files inside the bucket, then remove the bucket policy.

Go to the bucket’s policy (Bucket -> Properties -> Permissions -> Edit bucket policy).

Save the changes to the bucket policy.

Now right-click on the bucket and press Delete.

AWS t1.micro 100% CPU

Sometimes EC2 CloudWatch monitoring shows 100% CPU usage, but when you SSH into your instance and check it with ‘top’, it’s hard to tell what is happening. Amazon is probably “borrowing” some of your CPU cycles to give to someone else who needs them. This is standard practice in a virtualized environment where physical server resources like RAM and CPU cycles are often heavily overcommitted.

slowTo check for CPU steal, run top and look at the %st value. If this value is anything other than zero, your VM’s CPU cycles are being “borrowed”.

To watch per-core steal time continuously over 1-second intervals, you can also run:

mpstat -P ALL 1

Modern Note: Legacy t1.micro shared baseline CPU aggressively when noisy neighbors spiked. Modern Nitro-based T3/T4g instances (and Dedicated hosts) isolate vCPUs much more predictably as long as CPU credits stay positive.

Recovering a Lost Amazon EC2 SSH Key

amazon-ec2If you lose your Amazon EC2 SSH key and can’t log in to your instance, this isn’t a big problem as long as your instance is EBS-based and uses an Elastic IP.

1. Upload your new SSH key, or use one generated by AWS.

2. Create an AMI of your instance.

3. Launch a new instance from your AMI and select the new SSH key.

4. Log in to your instance with the default user (ubuntu or ec2-user, depending on your original AMI).

5. Reassign the Elastic IP to the new instance.

6. Turn off the old instance and terminate it.

Modern Alternatives (No Instance Replacement Required): Today you can usually regain access without cloning an AMI by connecting via AWS Systems Manager Session Manager, pushing a temporary key through EC2 Instance Connect, or stopping the instance to attach its root EBS volume to a temporary rescue VM and updating ~/.ssh/authorized_keys directly.

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.

RDS Instance Sizes, maximum concurrent connections