Cloud computing has emerged as a fast-growing paradigm for storing/sharing data and delivering services over the Internet. It provides its users with a way to deal with information or data without investing in any new technology or resources of their own. Although cloud computing environment is viewed as a promising Internet-based computing platform, the security challenges it poses are also equally striking. Despite the rapid advancement of cloud computing technologies, security issues in cloud environments have to be addressed to a greater extent. Cloud security is one of the major issues that hinder the adoption of cloud computing and slow down its acceptance in many sectors. In this paper, we provide an overview of cloud computing, in-depth literature review on cloud security and privacy issues, and its research challenges. We also propose security patterns as a viable solution to cloud security and explain them with a simple template. The research goal of this paper is to provide a better understanding of cloud security and highlight the security concerns that should be addressed to realize the maximum benefits of cloud computing. Security patterns allow cloud developers to use security measures without being security experts. Also, a cloud environment can be reengineered by using security patterns to add missing security features. In this paper, we provide a pattern-based cloud security framework as a good practical approach to ensure security features in cloud environments.