The attacker was identified him as Mansour al-Amri, a 28-year-old Saudi national.
According to the security spokesperson for the Saudi Arabia's Interior Ministry, the attacker opened fire on the western gate of Al-Salam Palace in Jeddah, killing two guard members and injuring three others.
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.
The gunman had driven up to the gate of the palace and opened fire at the guards.
An AK-47 and thee Molotov cocktails were found on his person after the attack, the al-Arabiya news agency reported.
"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. (ANI)