Djibouti gained its independence on June 27 , 1977 . The territory was declared an independent nation in 1977 , and changed its name to the Republic of Djibouti . Djibouti joined the United Nations on September 20 , 1977 .