You put the EC2 instance in the same AWS Account / VPC as the database.
If you don't have access to that VPC you create a new AWS account you may have to copy the database and create a new account, using a process something like this:
- Set up new AWS account / VPC / subnets / etc
- Set up new RDS instance
- Use AWS Database Migration Service to copy old database to new. You can also use the database native tools, e.g. mysqldump
- Set up EC2 in new VPC, configure application to point at new RDS
AWS is not a simple hosting environment, it's a complex enterprise environment and people really need training to understand it. A simple environment like Digital Ocean / Lightsail is better for simple needs.