You can format it in Word or Google Docs. Set your page size, adjust margins, and make sure there’s enough space for binding. For eBooks, make sure your file is properly formatted for Kindle (.epub is best).
Here are 2 helpful guides by Amazon KDP themslves: