An excerpt from the repository, fetched Nov 13, 2026.
Read the project’s introduction
Deploy your website to S3
Please note that this project is not actively maintained. Consider using s3_website_revived instead.
What s3_website can do for you
Create and configure an S3 website for you
Upload your static website to AWS S3
Jekyll, Nanoc, and Middleman are automatically supported
Help you use AWS Cloudfront to distribute your website
Improve page speed with HTTP cache control and gzipping
Set HTTP redirects for your website
(for other features, see the documentation below)
Install
gem install s3_website
s3_website needs both Ruby
and Java to run. (S3_website is partly written in Scala, hence the need for Java.)
Usage
Here's how you can get started:
Create API credentials that have sufficient permissions to S3. More info
here.
Go to your website directory
Run s3_website cfg create. This generates a configuration file called s3_website.yml.
Put your AWS credentials and the S3 bucket name into the file
Run s3_website cfg apply. This will configure your bucket to function as an
S3 website. If the bucket does not exist, the command will create it for you.
Run s3_website push to push your website to S3. Congratulations! You are live.
At any later time when you would like to synchronise your local website with
the S3 website, simply run s3_website push again.
(It will calculate the difference, update the changed files,
upload the new files and delete the obsolete files.)
Specifying the location of your website
S3_website will automatically discover websites in the _site and
public/output directories.
If your website is not in either of those directories, you can
point the location of your website in two ways:
Add the line site: path-to-your-website into the s3_website.yml file
Or, use the --site=path-to-your-site command-line argument
If you want to store the s3_website.yml file in a directory other than
the project's root you can specify the directory like so:
s3_website push --config-dir config.
Using standard AWS credentials
If you omit s3_id from your s3_website.yml, S3_website will fall back to reading from the default AWS SDK locations. For instance, if you've used aws configure to set up credentials in ~/.aws/credentials, S3_website can use these.
Using an AWS profile or a profile that assumes a role
If you omit s3_id, s3_secret, and session_token you can specify an AWS credentials profile to use via the profile configuration variable, eg:
profile: name_of_aws_profile
In addition, if you want this profile to assume a role before executing against S3, use the profile_assume_role_arn variable, eg:
profile_assume_role_arn: arn_of_role_to_assume
(Note: you have to use a regular profile with an ID and SECRET and specify the role ARN via a variable like this instead of a profile that specifies a role_arn as documented here since it does not look like the Java SDK supports that format, yet...)
Using environment variables
You can use ERB in your s3_website.yml file which incorporates environment variables:
s3_id: <%= ENV['S3_ID'] %>
s3_secret: <%= ENV['S3_SECRET'] %>
s3_bucket: blog.example.com
(If you are using s3_website on an EC2 instance with IAM
roles,
you can omit the s3_id and s3_secret keys in the config file.)
S3_website implements support for reading environment variables from a file using
the dotenv gem. You can create a .env file
in the project's root directory to take advantage of this feature. Please have
a look at dotenv's usage guide for
syntax information.
Your .env file should containing the following variables:
S3_ID=FOO
S3_SECRET=BAR
S3_website will also honor environment variables named AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN (if using STS) automatically if s3_id is ommitted from s3_website.yml.
Project goals
Provide a command-line interface tool for deploying and managing S3 websites
Let the user have all the S3 website configurations in a file
Minimise or remove the need to use the AWS Console
Allow the user to deliver the website via CloudFront
Automatically detect the most common static website tools, such as Jekyll, Nanoc, and Middleman.
Be simple to use: require only the S3 credentials and the name of the S3
bucket
Let the power users benefit from advanced S3 website features such as
redirects, Cache-Control headers and gzip support
Be as fast as possible. Do in parallel all that can be done in parallel.
s3_website attempts to be a command-line interface tool that is easy to
understand and use. For example, s3_website --help should print you all the
things it can perform. Please create an issue if you think the tool is
incomprehensible or inconsistent.
Additional features
Cache Control
You can use either the setting max_age or cache_controlto enable more
effective browser caching of your static assets.
max_age
There are two possible ways to use the option:
you can specify a single age (in seconds) like so:
max_age: 300
Or you can specify a hash of globs, and all files matching those globs will have
the specified age:
max_age:
"assets/*": 6000
"*": 300
After changing the max_age setting, push with the --force option.
Force-pushing allows you to update the S3 object metadata of existing files.
cache_control
The cache_control setting allows you to define an arbitrary string that s3_website
will put on all the S3 objects of your website.
Here's an example:
cache_control: public, no-transform, max-age=1200, s-maxage=1200
You can also specify a hash of globs, and all files matching those globs will have
the specified cache-control string:
cache_control:
"assets/*": public, max-age=3600
"*": no-cache, no-store
After changing the cache_control setting, push with the --force option.
Force-pushing allows you to update the S3 object metadata of existing files.
Content type detection
By default, s3_website automatically detects the content type of a file with the help of Apache Tika.
For some file types Tika's auto detection does not work correctly. Should this problem affect you, use the content_type
setting to override
Read the full README on GitHub