If you use iMessage, you can access and query the database where all of the messages are stored. All you need is a Mac and some basic SQL skills to begin!
When it comes to AWS remote database management, if you can't install the agent directly on the private host, you can set up a bastion running the agent.