Biodiesel contains methyl or ethyl esters of long-chain fatty acids and has recently attracted increasing attention. Microalgae have emerged as a sustainable biodiesel production system owing to their photosynthetic potential. However, the conversion of microalgal biomass to biodiesel requires high energy and is costly. This study aimed to overcome the high cost of the pretreatment process by generating cyanobacteria converting fatty acids to fatty acids methyl ester (FAME) in vivo by introducing the fatty acid methyl ester transferase (FAMT) gene. Two FAMT genes from Drosophila melanogaster and Arabidopsis thaliana were selected and their codons were optimized for insertion in the Synechocystis sp. PCC6803 genome through homologous recombination, respectively. FAMT mRNA and protein expression levels were confirmed through reverse-transcription PCR and western blot analysis, respectively. Furthermore, heterologous expression of the FAMT genes yielded FAME, which was analyzed by gas chromatography. We found that FAMT transformants can be further metabolically optimized and applied for commercial production of biodiesel.