Edge computing has received wide attention due to the benefits it brings compared to the existing cloud computing model. With the emergence of this new paradigm, content service providers (CSPs) can extend their existing cloud-based CDN (content delivery network) to edge environments to achieve cost-effectiveness. Specifically, for those regions with many access requests, edge services can be rented for saving bandwidth costs. However, the cost of renting edge services is not negligible. If edge services are rented in places with few access requests, high renting costs will cause economic losses instead. Therefore, CSPs need to make rental decisions dynamically without any knowledge of the future. For solving this problem, we summarize it as an online edge service renting problem, and propose a randomized online edge-renting algorithm for CSPs to rent edge services cost-effectively. Through theoretical analysis, we prove that the cost of our algorithm would not exceed e/(e−1+α) times compared to the corresponding optimal algorithm, where α is the bandwidth discount of edge service compared to the cloud. Lastly, by verifying through experiments, the results show that our online algorithm can help CSPs save 11.9% of the total cost in edge service renting.