Actually, this is my homework, I tried to record the step for how I resolve this issue.
I had read some articles and tried many ways(include heroku official document),
but it didn't work.
So I tried to read amazon official document and did some settings myself. Finally,
it works fine.
following are my steps:
(I assume that your app have already run well on heroku)
first, add this gem to your gemfile:
add aws.yml under config folder:
then restart your rails server(for local test)
Done! Paperclip will save your images on amazon s3 automatically!