The gunman has been identified as Mansour al-Amri, a 28-year-old Saudi national.
The victims have been identified as Agent Sergeant Hammad bin Shallah al-Mutairi and First Soldier Abdullah bin Faisal al-Subaie, the Saudi Ministry said.
"Due to the possibility of ongoing police activity, American citizens are advised to exercise caution when travelling through the area," the embassy warned in a statement.
According to the national security agency, the warning came after the Saudi Police raided hideouts of a suspected terror cell linked to the Islamic State group this week, killing two people and arresting five.
Local media reports said that the State Security Agency said police raided three hideouts in the capital Riyadh and exchanged gunfire in one of them. (ANI)