With the advent of virtualization technologies, cloud computing is experiencing an explosive growth. Resource allocation issue plays an important role in the commercial cloud platforms. However, the existing studies have not fully considered the heterogeneous demands from different cloud tenants. To tackle this, we design a more flexible cloud resource allocation mechanism which can maximize the profit of the cloud provider and support three general types of resource requirements from the cloud tenants. In this work, we assume that both the VMs (Virtual Machines) supplied by the cloud provider and the jobs submitted by the cloud tenants are heterogeneous, and the jobs from tenants will bid for the usage of VMs in 3 types: 1) fixed time intervals, 2) continuous time intervals in particular time ranges and 3) some time intervals summed to no more than certain values within particular time ranges. We proved that the studied optimal allocation problem is NP-complete. To allocate VMs to different types of jobs efficiently, we first release the studied problem into a linear programming (LP). Since linear programming can be solved optimally, we further use the coloring technology to transfer the optimal solution of the linear programming into a feasible solution of the allocation problem we studied. We proved that the proposed approximation allocation mechanism has an approximation factor of max_1 ≤ m ≤ M (c_m+1)^c_m/(c_m +1)^c_m-c_m^c_m, where M denotes the number of types of heterogeneous VMs and c_m is the number of VMs belong to the m-th type. The evaluation results corroborate our theoretical analysis, and show that the proposed methods achieve high efficiency. To the best of our knowledge, there have not yet been any studies jointly considered all these three types of job requirements and give a near-optimal allocation mechanism with performance guarantee.