Post by Paperplane23 » Sat Aug 16, 2025 8:14 am

I need information about the best way to set up OpenCart on AWS EC2. We are using a managed AWS provider HostJane, because it's cheaper than hourly t3 series computes, but after several issues encountered I am wanting info on what AWS direct EC2 servers are recommended by OpenCart? As you're all aware OpenCart requires a MySQL database connection (e.g., port 3306). If the EC2 instance hosting OpenCart or the RDS instance hosting the database has a security group that doesn’t allow inbound traffic on port 3306 from the relevant source (e.g., the EC2 instance’s private IP or security group ID), the connection fails. This was the issue we had with Hostjane. The EC2 instance and RDS were in different Virtual Private Clouds (VPCs) or subnets without proper routing. To their credit they patiently resolved it this week but if anyone is using AWS hosting, what is the optimum EC2 instances to use, and any load balancer details would be greatly appreciated.

Our issue

We set up an OpenCart installation on a HostJane EC2 instance running Ubuntu 22.04 LTS with Apache and PHP, using an AWS RDS MySQL instance for the database. HostJane configure the EC2 security group to allow HTTP (port 80) and HTTPS (port 443) for web access but overlook the RDS security group. By default, RDS security groups block all inbound traffic unless explicitly allowed. Without an inbound rule allowing port 3306 from the EC2 instance’s security group or IP, OpenCart cannot connect to the database, resulting in installation failure or runtime errors.

We've been troubleshooting this with their support. They added an inbound rule to the RDS security group allowing port 3306 (MySQL) from the EC2 instance’s security group or private IP address (e.g., 10.0.0.0/16 for a VPC), and also ensured the EC2 instance’s security group allows outbound traffic to port 3306 (default for MySQL) to the RDS instance. They also confirmed that the EC2 and RDS instances are in the same VPC or have proper routing configured via route tables if in different VPCs, which turned out to be the problem.

They used either telnet or mysql on the EC2 instance to test connectivity to the RDS endpoint (e.g., telnet rds-endpoint 3306), and then I updated OpenCart’s configuration files (/var/www/html/config.php and /var/www/html/admin/config.php) with the correct RDS endpoint, database name, username, and password.

Newbie

Posts

Joined
Sat Aug 16, 2025 7:16 am

Post by khnaz35 » Sat Aug 16, 2025 4:27 pm

I have set up AWS environments multiple times, and based on my experience, I recommend a simpler approach if you want to avoid the complexities of RDS, VPS, security groups (inbound/outbound rules), and cross-zone configuration issues. Instead, you can install MySQL directly on the same EC2 instance, configure it properly, and your connectivity problems will be resolved.

However, if you believe RDS is the only viable option for your use case, then you should consider using the AWS CLI to verify connectivity from your EC2 instance to the RDS endpoint.

By the way, which t-series instance type are you currently using? Also, what level of traffic are you handling or planning to handle with this setup?

Got a burning question at 3 AM that even Google shrugs at? There’s a not-so-secret inbox that might just have your answer: khnaz35@gmail.com
Breathe in some nature while you're at it. It’s cheaper than therapy. :-*

Feel free to sling a bear my way via PayPal @ khnaz35@gmail.com


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia
Who is online

Users browsing this forum: No registered users and 19 guests