Rails 3 library that uploads all static assets to amazon s3 with a unique id encoded into the path
Alternatives To Asset_id
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
S3fs Fuse7,532
a day ago4March 09, 2022223gpl-2.0C++
FUSE-based file system backed by Amazon S3
2 months agoApril 04, 2020269apache-2.0Go
a high-performance, POSIX-ish Amazon S3 file system written in Go
7 days ago1February 27, 2018295gpl-2.0Python
Official s3cmd repo -- Command line tool for managing Amazon S3 and CloudFront services
Fake S32,905136136 months ago21August 15, 2018119Ruby
A lightweight server clone of Amazon S3 that simulates most of the commands supported by S3 with minimal dependencies
Mc2,5541527a day ago50April 22, 202145agpl-3.0Go
Simple | Fast tool to manage MinIO clusters :cloud:
Bucket Stream1,447
4 years ago4mitPython
Find interesting Amazon S3 Buckets by watching certificate transparency logs.
5 years ago529apache-2.0JavaScript
The official @github repository of the Trovebox frontend software. A photo sharing and photo management web interface for data stored "in the cloud" (i.e. Amazon S3, Rackspace CloudFiles, Google Storage).
Aws Toolkit Vscode1,181
2 days ago356apache-2.0TypeScript
CodeWhisperer, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
Amazon S3 Php Class98039103 years ago2April 27, 201568PHP
A standalone Amazon S3 (REST) client for PHP 5/CURL
2 months ago6apache-2.0Shell
A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq.
Alternatives To Asset_id
Select To Compare

Alternative Project Comparisons

Asset ID – Asset stamping and uploading to S3 for Rails


Uploads static assets to Amazon S3 with unique identifiers encoded into the path of the asset.

Only works with Rails 3.x because Rails 3 makes doing this sort of thing a lot easier and
that is all I needed it for.

This library takes standard Rails asset paths such as /stylesheets/main.css?1288717704 and converts them

It uses an MD5 hash of the file contents to produce the id so the same asset will always have the same ID.

In my quest to achieve a Google Page Speed score of 100, this library achieves the following:

  • Assets served from a cookie-less domain
  • Unique identifier is not encoded into a query parameter (so it is cacheable by proxy servers)
  • All assets have far-future expires headers for caching
  • Assets have the Cache-Control: public header for caching
  • CSS and javascript is GZipped and the correct headers are added

As an added bonus, all your assets are available over https:// as well.


Add the gem to your Gemfile

gem "asset_id"

Configure config/environments/production.rb to use Amazon S3 as the asset host
and to use the id-stamped asset paths in helpers

config.action_controller.asset_host = do |source|
config.action_controller.asset_path = do |source|

Add your Amazon S3 configuration details to config/asset_id.yml

  access_key_id: 'MY_ACCESS_KEY'
  secret_access_key: 'MY_ACCESS_SECRET'
  bucket: "my_live_bucket"

Optionally create a rake task in lib/tasks/asset_id_tasks.rake to
perform the upload for use in your deploy scripts

namespace :asset do
  namespace :id do
    desc "uploads the current assets to s3 with stamped ids"
    task :upload do
      AWS::S3::DEFAULT_HOST.replace "" # If using EU bucket
      AssetID::Asset.asset_paths += ['favicon.png'] # Configure additional asset paths

SSL configuration

If you want to use the SSL host in your configuration you can do so in config/environments/production.rb

config.action_controller.asset_host = do |source|
  request.ssl? '' : ''

CSS Images

By default any relative CSS images that match files on the filesystem are converted to AssetID paths as well.

For S3, if you don’t specify a prefix it will use the http:// bucket URL by default. You can override this in config/asset_id.yml. For example if you wanted to use the https:// url:

  access_key_id: 'MY_ACCESS_KEY'
  secret_access_key: 'MY_ACCESS_SECRET'
  bucket: "my_live_bucket"
  prefix: ""

Using Amazon CloudFront Content Delivery Network (CDN)

To use Amazon CloudFront as a CDN for your assets all you need to do is create a CloudFront distribution for the bucket you have defined your configuration and then substitute your unique CloudFront domain name in config/environments/production.rb

config.action_controller.asset_host = do |source|

SSL works fine here as well.

Popular S3 Projects
Popular Amazon Projects
Popular Cloud Computing Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Ruby On Rails