Hierarchical and identity-based encryption (HIBE) is very valuable and widely used in many occasions. In the Internet of Things based on cloud services, efficient HIBE is likely to be applied to cloud service scenarios for the limited computing ability of some terminal devices. What's more, because of the insecurity of cryptographic systems caused by side channel attacks, the design of leakage resilient cryptographic scheme has attracted more and more cryptography researchers' attention. In this study, an efficient leakage resilient HIBE is constructed. (1) In essence, this given scheme contains a hierarchical ID-based key encapsulation system. By using the extractor to act on the encapsulated symmetric key, this proposed scheme may resist the disclosure for the symmetric key due to side channel attacks. The relative leakage ratio of the encapsulated key is close to 1. (2) We also construct a hierarchical identity-based hash proof system that provides the security of our scheme. The proposed scheme can not only resist side channel attacks, but also has short public key parameters and computational efficiency, which is very suitable for applications in the Internet of Things environment. (3) There is no limit to the hierarchy depth of the system, and only the maximum hierarchy length is required to be given when the system is initialized.