Do I need to have a tax home in a foreign country in order to claim the foreign earned income exclusion?

Yes. To be eligible for the foreign earned income exclusion, you must have a tax home in a foreign country and be a U.S. citizen or resident alien. You must also be either a bona fide resident of a foreign country or countries for an uninterrupted period that includes an entire tax year, or you must be physically present in a foreign country or countries for at least 330 full days during any period of 12 consecutive months. U.S. citizens may qualify for the foreign income exclusion under either test. U.S. resident aliens must qualify under the physical presence test unless they are citizens or nationals of a country with which the United States has an income tax treaty in effect. In that case, U.S. resident aliens also may qualify for the foreign earned income exclusion under the bona fide residence test.

Your tax home must be in the foreign country or countries throughout your period of bona fide residence or physical presence. For this purpose, your period of physical presence is the 330 full days during which you are present in a foreign country or countries, not the 12 consecutive months during which those days occur.