Here's the problem
You aren't disciplining him, instead you are punishing him, and yes there is a huge difference! Disciplining is about teaching someone new things, providing boundaries, and helping teach right vs wrong, and having non violent consequences for bad behaviour. Punishing, is about retaliating, doing something wrong to reply in kind for someone else doing something wrong.
Spanking is no different than slapping/punching someone in the face, its the same tactic but applied to a different area of the body. You aren't coming from a good place here, you are coming from a place of malice, anger, frustration, 100% the wrong approach. At nearly 2, he/she needs to be taught proper coping mechanisms for being angry/lashing out, instead YOU are amping up the situation by being violent towards your child, no excuses here! I have a nephew who is aggressive like that (he's 4) and he has pushed/pinched/slapped me before and I have NEVER hit him back, its called having self control and setting a good example for him, under no circumstances would I ever lay a hand on him.
The first thing you should be doing here is when he is being aggressive/violent etc, is to remove him from the whichever room he/she is in and place him in a room where the door can be closed and he/she can have time to cool down. This allows him/her to process her anger, and to think things through at their own pace without having someone in their face. A time out at 17 months, should be no more than 10 minutes, anything longer is too much at that age, anywhere from 5-10 mins is ideal.
Secondly, you need to gain some self awarness too and understand you too are not in a good place when you spank him, you too also need a time out as well, where you can cool down and learn not to respond in a violent manner towards your child, this should be no more than 10 minutes as well.
Thirdly, when the time out is over, that is when you discuss things with your son in a CALM (I need you to understand this word ) and non violent manner ( I will keep saying this until it sinks in!)! This is where you tell him that his behaviour is bad and it will not be tolerated, at 17 months they are old enough to understand it! Then you discuss with him why he is so angry, it could be something as he knocked over a drink, or he lost a toy etc, this is where you as a parent help guide him through appropriate coping mechanisms on how to behave in a more acceptable way!
The biggest thing and I will take this back to me discussing about you being violent here, because I cannot say this enough, it is NOT acceptable at all! First off, you are his role model, so how you behave/act, he will mimick it, so if your going around yelling at him, slapping him etc, he will conduct himself in the same manner! Secondly, assaulting someone does NOT de-escalate a situation, it only amp things up, think about it this way, if someone slaps you in the face you would get pissed and feel the need to hit back, see where I'm going with this? Lastly, assaulting someone does not get to the root of the problem, the problem is still there after the assault is over.