I’d say you can have the full Costa del Sol experience in a week. You can base yourself in any one city and visit other towns like Nerja (be sure to try the paella in Ayo and visit the Cuevas de Nerja), Marbella, Fuengirola, and Mijas. More than two weeks could be overkill if you aren't used to the heat, as especially August can be extremely hot.
If you are staying in Costa del Sol for a week, avoid staying in more than one town. A week is too short a time to pack and unpack.Just use one town for your base and travel. We would really recommend Nerja for family and couple holidays, really relaxing, lovely atmosphere, good food, and nice beaches. You can't fault it and you can travel along the coast to Maro, Almunecar, Torre del Mar to get a bit of variety.