If your business is built on an ECS instance and you need to access an RDS instance from the ECS instance, we recommend that you establish the connection over the intranet. This increases the transmission rate and ensures security.
For more information, see How do I connect to an ApsaraDB for RDS instance?.