The 33-year-old was officially a free agent after his contract at Liverpool had expired earlier this summer.
Bellamy, who enjoyed a loan spell with his hometown club during the 2010/11 season, will join his team-mates next week ahead of their Championship opener against Huddersfield.
"I would like to place on record my thanks to a number of key parties that have facilitated Craig's return," Bluebirds chief executive Alan Whiteley told the club's official website.
"I would also like to thank our manager for his tenacity and single mindedness in ensuring the transfer could take place - and for making my life a misery until such time as it could be completed!
"Finally to Craig, for having the confidence and courage to buy into and wanting to be a part of the club's future. Craig's return will be met with huge excitement and enthusiasm by all Cardiff City fans - and as the perfect backdrop to the start of the new season."