As in the case of the 23rd July 2017 incident in which an Israeli security guard killed 2 Jordanians outside of Israel's embassy to Jordan, if the guard has diplomatic immunity, does that mean he can "kill whomever" and never get prosecuted?
The restrictions on embassy staff are diplomatic and political rather than legal. The Vienna Convention says that a diplomatic agent "shall enjoy immunity from the criminal jurisdiction of the receiving State." (Article 31, including the full stop). It also says that "members of the service staff of a mission who are not nationals of or permanently resident in the receiving State shall enjoy immunity in respect of acts carried out in the course of their duties..." (Art 37). So assuming that the Israeli Ambassador states that the shooting was in the course of the security guard's duties and he does not wish to waive immunity, and that the guard was an Israeli rather than a local hire; yes, the Jordanian authorities can do nothing to this guard, even if he does the same thing tomorrow.
Well, was it a diplomat or a security guard? If it’s the former, then he would have immunity. The course of action would be to expel the diplomat and file a complaint with his native country. There is a chance the native country will waive the diplomat’s immunity or prosecute him itself. Lower level staff at embassies may not have full immunity, but more limited immunity, typically related specifically to their diplomatic jobs.
I can’t find nor have I heard of any precedent of a security guard maintaining diplomatic immunity. That said, if he is a direct employee of the state, perhaps an argument could be made that he does have immunity. If he is an employee of a private security company, that argument would be harder to make.
There is precedent for the diplomat’s country waiving immunity in instances of very serious crimes and/or crimes committed that are not directly connected to the diplomat’s job (e.g., alleged murder vs. alleged espionage).