Big data and cloud computing are two advanced technologies that have overcome many computing and analytical challenges in recent years. With the rise in the applications of these technologies, the necessity of efficiency and optimization in the utilization of related resources has made sense. The procedure of locating virtual machines (VM) in physical machines (PM) affects the performance, speed, and costs of cloud computing services. VM placement in cloud computing is an NP-hard problem. Indeed, the problem is more complicated in big data tasks due to the need for transferring high volumes of traffic between VMs. This paper proposes a new approach for VM placement in a multi data center (DC) cloud environment. The aware genetic algorithm first fit (AGAFF) is a context-aware algorithm that distinguishes big data tasks with an input tag and uses a structure to minimize the traffic between MapReduce nodes. This multi-objective algorithm is based on the genetic algorithm, which is incorporated with the first fit methodology. The algorithm minimizes energy usage by minimizing the number of used servers, intra-DC traffic of big data tasks, and VMs' live migration while maximizing relevant usage of CPU and RAM in every server. Furthermore, it improves job execution time, especially in big data processing, and reduces service level agreement (SLA) violations. A comparison between the results of AGAFF and four other algorithms shows by about 61% energy consumption reduction on average on different scales and approves a decrease in the number of needed PMs, intra-DC traffic of big data processing, and the number of live migrations.