Attanasio started his diplomatic career in 2003, at the Farnesina, as Directorate for Economic Affairs, Business Support Office, and then to the secretariat of the Directorate General for Africa. A year later he became deputy head secretariat of the undersecretary of state with responsibility for Africa and International Cooperation. Attanasio started his diplomatic career outside Italy in 2006, serving as the Economic and Commercial Office at the Italian Embassy in Bern (2006–2010) and the Regent Consul General in Casablanca, Morocco (2010–2013). In 2013 he returned to the Farnesina where he was appointed Head of the Secretariat of the Directorate General for Globalization and Global Affairs. He then returned to Africa as first counselor at the Italian embassy in Abuja, Nigeria, in 2015. From 5 September 2017 until his death he was head of mission in Kinshasa, Democratic Republic of Congo. From 31 October 2019 he was confirmed on site as an Extraordinary Plenipotentiary Ambassador accredited in the DRC. In October 2020, he was awarded the Nassiriya International Prize for Peace. Attanasio was one of Italy's youngest ambassadors.
At 10:30 am on 22 February 2021, a World Food Programme (WFP) convoy of three vehicles, carrying a total of seven people, of the MONUSCO, the United Nations mission for the stabilization of the Democratic Republic of Congo, in which Attanasio was travelling, was attacked by six armed individuals. The convoy was travelling in North Kivu, from the province's capital of Goma to a WFP school feeding programme in Rutshuru, a town 70 kilometres (43 mi) north of Goma, on a route that would have taken the vehicles through Virunga National Park. The attack occurred near the townships of Kibumba, and Kanyamahoro. The WFP has stated the attack occurred on a road that had previously been cleared for travel without security escorts.
Attanasio was the main target of the attack. As the gunmen attempted to kidnap him, they opened fire, killing Mustapha Milambo, the Congolese UN driver. Then they threatened the six other members of the convoy and brought them to the nearby forest. As local security forces were arriving at the scene following the report of shots fired, the gunmen killed 30-year-old carabiniere Vittorio Iacovacci and mortally wounded Attanasio. The attackers then kidnapped three of the hostages and fled the scene, while a third Italian national escaped unharmed. Attanasio was hospitalized in critical condition at the UN Hospital in Goma, but died there an hour later after his admission due to gunshot wounds to his abdomen, bringing the total number of deaths resulting from the attack to three. Attanasio was the first foreign ambassador to be killed in the DRC since 1993, and the first Italian ambassador killed while serving his term.
The Democratic Forces for the Liberation of Rwanda were accused of being behind the attack by local authorities. However, the group denied any responsibility and condemned the attack, calling it 'ignoble'.
Attanasio was married to Zakia Seddiki, a Morocco-born woman from Casablanca, since 2015. She is the president of a Congolese non-governmental organization providing assistance to women and children. They had three daughters.