It would be best to go to the motherboard site to see what ram is compatible with that mb. But yes that is the type of ram you would need. DDR4 SDRAM
Click on Memory support and then find Ram that has the same corresponding numbers as some on the list.https://www.msi.com/Motherboard/support/Z270-GAMING-PRO-CARBON.html#support-cpu
I would suggest you do not buy used ram.