With the growth of the requirement of users, it becomes a challenge that how to ensure the security of data resources sharing in extended virtual machine system. In order to solve this problem, we propose a secure sharing mechanism which is based on the ciphertext-policy attribute-based encryption scheme (CPA scheme). In the secure sharing mechanism, the corresponding data attributes are defined for each owner and some corresponding algorithms are proposed for different processes. In order to justify the feasibility and availability of the sharing mechanism, a series of experiments have been done. The results show that it is feasible to ensure the security of data resources sharing in extended virtual machine system.