I have to make an assumption here. That assumption is that you have a free upgrade license. If this is not the case please comment and I can update the answer accordingly.
Since the Windows 10 Anniversary Update your free license is associated with you Microsoft account. This is assuming you have linked your computer with you MS account. If you have you will simply just need to reinstall and Head to Settings > Update & Security > Activation and you’ll see a “Troubleshoot” option if activation failed. Click that option and sign in with the Microsoft account you associated your license with. You’ll be able to tell Windows that you “changed hardware on this device recently” and select your PC from a list of devices associated with your Microsoft account.
I have personally used this process and it does work.
Please note that I referenced and used some information from this article on howtogeek.com
If you have not associated your PC with you MS account then hopefully you system is okay enough to run start ms-settings from the command prompt and open the setting window (omit start if you are using the run dialog).
Happy installation.
Digital License
, simply replacing your hard drive won't be a problem. Take a few minutes to read through this previous question: Reset Windows 10 from USB