"I have a real passion for what I do and have always committed 100 percent but I have to listen to my body when enough is enough.
"If I can't do something 100 percent physically and mentally then it's time to find a new challenge and start a new adventure.
"I can't keep pushing at the level that I need and want to in order to achieve the results that will make my country, my family and my friends and most importantly myself, proud."
Shanks said that her hip is improving and she believes she could win a spot in the team for Glasgow, but does not want to just attend if she cannot be at the level to win a gold medal again.
"I have been out of competition for so long now. I have been working hard but the spark and passion that drives me is not there. The way I work with my husband and coach Craig, we are not willing to do something unless we can do it to the absolute best that I can be.
"It has been tough to let go but I know this decision to retire from cycling is right one and I will step away satisfied and proud of what I have achieved with the help of a massive support team including HPSNZ, BikeNZ and my team of sponsors
"I am disappointed that I won't race on the new Avantidrome in Cambridge but there will always be 'another race' as the cycling world carries on but in every athlete's career there has to be one final finish line and I've reached mine."
BikeNZ High Performance Director, Mark Elliott said that Shanks had made a tough call but it was typical of her attitude that she did not want to continue in the sport unless she could be the best in the world.
"Since Sarah Ulmer, our ranks in terms of female endurance track riders have been quite thin. Ali took up that challenge in terms of individual pursuit, coming into the sport late, and her results speak for themselves," Elliott said.
"She achieved world titles and a Commonwealth Games gold medal on the back of complete dedication and a single-minded attitude to be the best she could be.
"When the women's team pursuit was brought in to the Olympic programme instead of the individual pursuit, Alison put her personal disappointed behind her and played a key role in that campaign leading up to the London. While they did not get the medal they were chasing, their hard work and commitment could not be faulted.
"Alison battled with the hip injury and since her surgery she has done everything possible to get herself back. Her decision today is a testament to her uncompromising attitude.