Help: I want to configure wallet.dir to be saved on aws s3 instead of locally I'm building bitcoin from source to add some functionality. The main reason is that I want to use AWS S3 to store my wallet.dat file (for security reasons) instead of being stored locally.
Basically, I want all the references to the wallet directory and file to be through aws-cli, instead of directly on the machine. I'd be thankful for any suggestions.

Running on ubuntu 16.04 (EC2), headless.

Thanks!
You'd have to rewrite the relevant pieces of the Bitcoin Core source code to do this directly.  It'll be particularly challenging because access to wallet.dat is not done directly, but through the bdb library, so you'd have to hack that as well.

Probably a better approach would be to have a script that periodically backs up the wallet.dat file to your s3 bucket.  However, you'll have to temporarily shut down Bitcoin Core to do that, because if you copy wallet.dat while it's being written to, you might get an inconsistent copy that doesn't work. 

I'm not sure of the best tools these days for interacting with the s3 API.  s3cmd is one option, though I've had issues recently with it not working, which I haven't unraveled yet.