Ramsey was a free agent after his contract with French Ligue 1 side OGC Nice ended last month.
The 32-year-old started his career with Cardiff City before joining Arsenal in 2008.
Ramsey rejoined the Welsh club for a short loan in the 2010/2011 season.
Ramsey made 22 appearances during his first stint at Cardiff and six more during his loan spell.
Ramsey told Cardiff’s website: “It feels unbelievable to finally be back here. I always thought one day I’d come back, and now it’s the perfect time to do that.
“To be back with my family and around familiar faces is just brilliant, so I’m delighted to be back here now. I’ve missed that a lot in the last year or so, so it was important for me to be back around them.
“Obviously I’m a Cardiff City fan and watching them over the years since I’ve been away, we’ve had some low points but some big highs as well, being in the Premier League and representing Cardiff on the big stage. That’s a target of mine – to try and help my team-mates and this club to get back to the top.
“I owe so much to Cardiff, to the fans, to everybody who has been at the club when I was here as a young boy coming through. For me now to come full circle, to be part of this team now, and hopefully achieve the goals we want, there’s no better feeling than that.”
During eleven years at Arsenal, Ramsey won three FA Cups and also won the Serie A title in a three-year spell with Juventus.
Ramsey has scored 20 goals in 82 caps for the Wales national team.