<p>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 <code>wallet.dat</code> is not done directly, but through the <code>bdb</code> library, so you'd have to hack that as well.</p>

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

<p>I'm not sure of the best tools these days for interacting with the s3 API.  <a href="https://s3tools.org/s3cmd" rel="nofollow noreferrer"><code>s3cmd</code></a> is one option, though I've had issues recently with it not working, which I haven't unraveled yet.</p>

CC BY-SA 4.0
2019-01-28T09:37:41.290Z
Thaks mate! Yeah, I already tinkered with it and wrote a script to backup wallet.dat periodically (with aws-cli, was pretty straghtforward to be fair). What I'm trying to achieve here is securing wallet.dat completely by removing it from the bitcoin server and using amazon's security measures by having it stay in a bucket.
In any case, thanks a lot for the reply, you gave me some food for thought :)
Dan Zlotnikov
CC BY-SA 4.0
2019-01-28T15:57:12.197Z
@DanZlotnikov: The amount of security this adds seems limited, since the API key will need to be somewhere on the server.  So an attacker who gets access to the server can get the key and retrieve the file.  I suppose it might help avoid some attacks where they only get limited access to the server.
Nate Eldredge
CC BY-SA 4.0
2019-01-27T16:18:45.953Z
2019-01-27T16:18:45.953Z
Nate Eldredge
<p>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.</p>

<p>Running on ubuntu 16.04 (EC2), headless.</p>

<p>Thanks!</p>

<wallet.dat>
Help: I want to configure wallet.dir to be saved on aws s3 instead of locally
Dan Zlotnikov
# Help: I want to configure wallet.dir to be saved on aws s3 instead of locally

(Asked by: username_0 on 2019-01-27)

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!

**Tags:** wallet.dat


---

## 1 answers

### Answer by username_1 on 2019-01-27. Score: 1

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`](https://s3tools.org/s3cmd) is one option, though I've had issues recently with it not working, which I haven't unraveled yet.

> **Comments:**
> **username_0**: Thaks mate! Yeah, I already tinkered with it and wrote a script to backup wallet.dat periodically (with aws-cli, was pretty straghtforward to be fair). What I'm trying to achieve here is securing wallet.dat completely by removing it from the bitcoin server and using amazon's security measures by having it stay in a bucket. In any case, thanks a lot for the reply, you gave me some food for thought :)  
> **username_1**: @username_0: The amount of security this adds seems limited, since the API key will need to be somewhere on the server.  So an attacker who gets access to the server can get the key and retrieve the file.  I suppose it might help avoid some attacks where they only get limited access to the server.  

---

