Is diabetes hereditary?

My grandpa from my dads side has diabetes, his daughter (my aunt) has diabetes, and my dad also just got diagnosed with diabetes.....

I’m scared that I’ll also get diabetes....what are the chances that I will end up getting it? Is there anything I can do to prevent that?