After completing 1031 Exchange, changing home to primary

Question related to depreciation tax and capital gain tax.

 

Situation-

i sell 2 rental properties . one bought at 400 and second bought at 500. Sold both at $2M.  Kept properties as a rental for 10 years. Now, can I do 1031 exchange and buy 1 property at 4M, rent that property and then after 2 years make that property as my primary residence. 

What would be tax in this case?

Thanks.