RDS Custom Engine Version: Install Custom MySQL/Postgres

RDS Custom, when you’re trying to get your own MySQL or PostgreSQL flavor running, isn’t just about dropping your binaries into a box; it’s about convincing RDS that your custom build is a legitimate, manageable database instance. The core issue is that RDS Custom expects your engine to adhere to a strict contract for patching, monitoring, and lifecycle management. When your custom engine doesn’t report its status correctly, or if it deviates too much from expected behavior, RDS will refuse to recognize it as a healthy, manageable instance, leading to installation failures or unrecoverable states.

Common Causes and Fixes:

  1. Incorrect db.conf Configuration: The db.conf file is your custom engine’s primary communication channel with RDS. If the [rds] section, specifically parameters like EngineName, EngineVersion, MajorVersion, MinorVersion, PatchVersion, and BuildDate, doesn’t precisely match what RDS expects or if it’s missing, RDS won’t identify your engine correctly.

    • Diagnosis: SSH into the instance before it fails or during the initial setup phase. Navigate to /opt/rdsdb/etc/ and inspect db.conf. Ensure the [rds] section is present and all version-related fields are populated. For example, a custom MySQL 8.0.30 might have:
      [rds]
      EngineName=MySQL
      EngineVersion=8.0.30
      MajorVersion=8
      MinorVersion=0
      PatchVersion=30
      BuildDate=2023-01-01T00:00:00Z
      
    • Fix: Correct the db.conf file with the exact values that align with your custom build. The BuildDate should be a recent, valid ISO 8601 timestamp.
    • Why it works: RDS uses these fields to catalog and manage your custom engine version. Mismatches prevent it from registering your engine properly.
  2. Missing or Incorrectly Configured rds_app_config.json: This file, typically found in /opt/rdsdb/etc/, contains critical application-level configurations that RDS Custom relies on for managing your database. Missing entries or incorrect JSON formatting can lead to failure.

    • Diagnosis: Again, SSH into the instance and check /opt/rdsdb/etc/rds_app_config.json. Look for keys like engine_type, engine_version, major_version, minor_version, and patch_version. Ensure the JSON is valid. A typical entry might look like:
      {
        "engine_type": "MySQL",
        "engine_version": "8.0.30",
        "major_version": "8",
        "minor_version": "0",
        "patch_version": "30",
        "port": 3306,
        "log_files": [
          "/var/log/mysql/error.log"
        ],
        "pid_file": "/var/run/mysqld/mysqld.pid"
      }
      
    • Fix: Ensure rds_app_config.json exists, is valid JSON, and contains all required keys with values matching your custom engine.
    • Why it works: RDS uses this file to understand the specific configuration and operational details of your database engine.
  3. Improperly Installed PostgreSQL Extensions: For custom PostgreSQL, if you’re relying on extensions, they need to be installed in a way that RDS Custom can discover and manage them. Installing them directly into the PostgreSQL lib directory without proper registration can cause issues.

    • Diagnosis: After installation, try to connect to your custom PostgreSQL instance and check pg_available_extensions. If your custom extensions aren’t listed or if CREATE EXTENSION fails, they aren’t properly recognized.
    • Fix: Use the rds-data-api tool (if available in your custom build environment) or ensure extensions are installed in a path that your postgresql.conf (specifically shared_preload_libraries and extension_paths) points to, and that the RDS agent can detect them. For typical installations, extensions are often compiled and installed into /usr/lib/postgresql/X.Y/lib/ or similar.
    • Why it works: RDS Custom needs to understand which extensions are present to manage them during upgrades and patching.
  4. Firewall/Security Group Issues Blocking RDS Agent Communication: RDS Custom instances rely on a local agent that communicates with the RDS control plane. If your custom configuration or security settings (like iptables or security groups on the instance itself) interfere with this communication, the instance will be marked as unhealthy.

    • Diagnosis: Check /var/log/rdsdb/rdsdb.log on the instance for messages related to communication failures or timeouts with the RDS control plane. Look for errors indicating it cannot reach specific AWS endpoints or internal RDS services.
    • Fix: Ensure that iptables rules on the instance allow outbound traffic on necessary ports (typically 443 and 80) to AWS endpoints. If you’re using a custom AMI, verify that no security hardening has inadvertently blocked these essential outbound connections.
    • Why it works: The RDS agent must be able to "phone home" to AWS to report status, receive commands, and participate in the managed lifecycle.
  5. Incorrectly Compiled Binaries (e.g., Missing mysqld_safe or pg_ctl): RDS Custom expects standard startup scripts and management tools like mysqld_safe for MySQL or pg_ctl for PostgreSQL to be present and functional. If your custom build process omits or modifies these critical components, RDS won’t be able to start, stop, or manage the database process.

    • Diagnosis: SSH into the instance and try to manually start the database using the expected startup script (e.g., /usr/sbin/mysqld_safe or pg_ctl start). If these commands are missing or fail with specific errors about missing dependencies or incorrect usage, this is your culprit.
    • Fix: Recompile your custom MySQL or PostgreSQL binaries, ensuring that standard startup scripts (mysqld_safe, pg_ctl) are included and correctly configured to run the database process.
    • Why it works: RDS uses these standard scripts to control the lifecycle of the database process, and they must be present and operational.
  6. Non-Standard Data Directory or Log File Locations: RDS Custom expects database files and logs to reside in predictable locations (e.g., /var/lib/mysql for data, /var/log/mysql/error.log for logs). If your custom build uses entirely different paths and these aren’t correctly registered in rds_app_config.json or db.conf, RDS won’t be able to find or manage them.

    • Diagnosis: Examine the database’s configuration files (e.g., my.cnf for MySQL, postgresql.conf for PostgreSQL) on the instance. Compare the datadir and log_error (or equivalent) settings with the paths specified in rds_app_config.json and db.conf.
    • Fix: Either reconfigure your custom build to use standard locations or update rds_app_config.json and db.conf to accurately reflect your custom data and log directory paths.
    • Why it works: RDS relies on these known locations to perform backups, apply patches, and monitor the database’s health.

Once these issues are resolved, the next error you’ll likely encounter is related to the RDS agent failing to register the instance with the AWS control plane due to certificate validation issues, which often stems from an improperly configured db.conf or missing CA certificates in your custom build.

Want structured learning?

Take the full Rds course →