No, it’s not a sin to kill in self defense.
God made my Soul, and for awhile gives me this Earthly body. HE has a time limit on my life, not another mortal.
I would argue that you not only have a right to defend the life that God gave you, but a duty to do so.