If you click on Heroku and use the assets of Rails 3.1, you are all set up.
In the CloudFront configuration on amazon, create your distribution and set the source to the URL of your application.
Then in the production.rb file add:
config.action_controller.asset_host = "xxxxxxxxx.cloudfront.net"
The host is the host of your CloudFront distribution.
Then, when deploying, make sure you are on the Cedar stack and these resources are compiled. This will add unique MD5 to the file names. When the request arrives on your CDN (it is automatically processed by the settings in the production.rb file), the CDN will either serve its version of the file, or first pull it from the source. This means that you do not need to push files to the CDN, they are automatically retracted.
, - , , CloudFront, .