Abstract: As cloud-based services become more numerous and dynamic, service providers have to address the problem on how to allocate the cloud resources to their services. Only by solving this problem can they enjoy the high efficiency and low cost from the cloud. Many researchers focus on resource provisioning based on virtual machines while we propose an allocation strategy based on service components. In this study, the allocation problem is modelled as a bin packing problem. We propose an algorithm and implement the resource allocation system based on it. We deploy several services on our cloud platform for experiments and the results indicate that the allocation system performs well.