How to estimate mining fee for raw transaction?
Have a look at fundrawtransaction (if you are okay using the internal wallet).
fundrawtransaction will give you back the used fee (next to the hex byte-array of the funded transaction) before signing or broadcasting the transaction.
The ideal workflow is:

createrawtransaction '[]' '{&quot;&lt;addr&gt;&quot;: &lt;amount&gt;}' //set no inputs
fundrawtransaction &lt;hex&gt;
you'll get back {&quot;hex&quot;:&lt;tx&gt;, &quot;fee&quot;: &lt;amount&gt;, &quot;changepos&quot;: &lt;pos of the change output&gt;}
Check the fee, maybe increase it (requires Bitcoin Core 0.14, use the feeRate of fundrawtransaction.
signrawtransaction &lt;hex&gt;
sendrawtransaction &lt;hex&gt;