Internet of Things devices are highly distributed over a large geographical area, and these devices have limited resources in terms of computing, connectivity, energy, and memory. If the virtual machine is placed nearer to the Internet of Things nodes, it increases their efficiency by manifold. Virtual machine placement optimization is a trial and error method. Many new algorithms will be proposed and their results are tested against the desired metrics, and the successful ones are continuously modified to get better results. Placement of the virtual machines is the main goal. Resources should be available based on the need and cannot be allocated statistically based on the peak workload elasticity of cloud traffic engineering. In this area, nature-inspired algorithms are preferred as they are capable of finding a better candidate solution in a vast problem search space. A few notable nature-inspired algorithms are flower pollination algorithm, particle swarm optimization algorithm, ant colony algorithm, ant bee colony algorithm, and firefly algorithm. Out of all these algorithms, particle swarm optimization and ant colony algorithms are the ones that attracted many researchers. In this chapter we discuss about how efficiently we managed the placement of the virtual machines, using these two nature-inspired algorithms, so that efficiency of the Internet of Things network is increased.