Looks like you have three weeks to spend (lucky!), so if I were you I would hop on the Adventure Cycling TransAmerica Trail and stay on that through Oregon and on into Idaho. Stay in the mountains in Idaho (i.e. on the TransAm Trail) and do not take the "southern route" across Idaho... The southern third of Idaho is a desert-scorcher in August, and you'll miss the mountain scenery of Idaho if you go south.
If you stay on the TransAm through Idaho you'll eventually cross over Lolo Pass into Montana. Lolo Pass is one the most scenic bike rides in the lower 48. The TransAm then takes you south through western Montana, through the town of Darby, and then up to Chief Joseph Pass. At the top of the pass you will need to leave the TransAmerica Trail and keep heading south back into Idaho. You'll be on US 93 at this point, and simply follow it south to Salmon, ID and then Challis, ID. After Challis you'll take Idaho highway 75 to Stanley, ID and then one more day of riding from Stanley onto Sun Valley, Idaho.
This will be a more mountainous route, but more scenic and cooler in mid-August. There are campgrounds in Salmon. In Challis stay at Challis Hot Springs, and near Stanley go to Red Fish Lake. I have ridden this same route multiple times and I enjoy cycling-touring the Idaho mountains on every trip. You won't be disappointed.