All Projects → bep → S3deploy

bep / S3deploy

Licence: mit
A simple tool to deploy static websites to Amazon S3 and CloudFront with Gzip and custom headers support (e.g. "Cache-Control")

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to S3deploy

Github To S3 Lambda Deployer
⚓️ GitHub webhook extension for uploading static pages to AWS S3 directly after commiting to master via Lambda written in Node.js
Stars: ✭ 23 (-94.93%)
Mutual labels:  static-site, deploy
Binserve
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ⚡️🦀
Stars: ✭ 401 (-11.67%)
Mutual labels:  static-site
Devblog
A lightweight, customizable personal blog template built with GatsbyJS and React
Stars: ✭ 312 (-31.28%)
Mutual labels:  static-site
Django Bakery
A set of helpers for baking your Django site out as flat files
Stars: ✭ 360 (-20.7%)
Mutual labels:  static-site
Skeleventy
A skeleton boilerplate built with Eleventy.
Stars: ✭ 318 (-29.96%)
Mutual labels:  static-site
Jquery Scrollto
jQuery ScrollTo - Smooth Scrolling to any jQuery/DOM Element
Stars: ✭ 363 (-20.04%)
Mutual labels:  static-site
Verless
A simple and lightweight Static Site Generator.
Stars: ✭ 276 (-39.21%)
Mutual labels:  static-site
Serverlessui
A command-line utility for deploying serverless applications to AWS. Complete with custom domains, deploy previews, TypeScript support, and more.
Stars: ✭ 434 (-4.41%)
Mutual labels:  deploy
Ipa Server
Upload and install IPA in web.
Stars: ✭ 392 (-13.66%)
Mutual labels:  deploy
Pipe
Continuous Delivery for Declarative Kubernetes, Serverless and Infrastructure Applications
Stars: ✭ 341 (-24.89%)
Mutual labels:  deploy
Site.js
Develop, test, and deploy your secure static or dynamic personal web site with zero configuration.
Stars: ✭ 338 (-25.55%)
Mutual labels:  static-site
Upme Plus
Smart Automation inside your browser for free. Start earning and double your followers
Stars: ✭ 318 (-29.96%)
Mutual labels:  static-site
Charge
⚡️ An opinionated, zero-config static site generator.
Stars: ✭ 368 (-18.94%)
Mutual labels:  static-site
Adapt
ReactJS for your infrastructure. Create and deploy full-stack apps to any infrastructure using the power of React.
Stars: ✭ 317 (-30.18%)
Mutual labels:  deploy
Assemble
Community
Stars: ✭ 3,995 (+779.96%)
Mutual labels:  static-site
Insomnia Documenter
Tool to create minimalist and beautiful API documentation pages using your Insomnia workspace export file.
Stars: ✭ 284 (-37.44%)
Mutual labels:  static-site
Gridsome Portfolio Starter
A simple portfolio theme for Gridsome powered by Tailwind CSS v1
Stars: ✭ 329 (-27.53%)
Mutual labels:  static-site
Unity Actions
Github actions for testing and building Unity projects
Stars: ✭ 358 (-21.15%)
Mutual labels:  deploy
Easy Deploy Bundle
The easiest way to deploy your Symfony applications
Stars: ✭ 446 (-1.76%)
Mutual labels:  deploy
Link Lock
Password-protect URLs using AES in the browser; create hidden bookmarks without a browser extension
Stars: ✭ 418 (-7.93%)
Mutual labels:  static-site

s3deploy

GoDoc Build Status Build status Go Report Card codecov Release

A simple tool to deploy static websites to Amazon S3 and CloudFront with Gzip and custom headers support (e.g. "Cache-Control"). It uses ETag hashes to check if a file has changed, which makes it optimal in combination with static site generators like Hugo.

Install

Pre-built binaries can be found here.

s3deploy is a Go application, so you can also get and build it yourself via go get:

 go get -u -v github.com/bep/s3deploy

To install on MacOS using Homebrew:

brew install bep/tap/s3deploy

Note that s3deploy is a perfect tool to use with a continuous integration tool such as CircleCI. See this for a tutorial that uses s3deploy with CircleCI.

Use

Usage of s3deploy:
  -V	print version and exit
  -bucket string
    	destination bucket name on AWS
  -config string
    	optional config file (default ".s3deploy.yml")
  -distribution-id string
    	optional CDN distribution ID for cache invalidation
  -force
    	upload even if the etags match
  -h	help
  -key string
    	access key ID for AWS
  -max-delete int
    	maximum number of files to delete per deploy (default 256)
  -public-access
        set public ACL on uploaded objects, defaults to private if not set.
  -path string
    	optional bucket sub path
  -quiet
    	enable silent mode
  -region string
    	name of AWS region
  -secret string
    	secret access key for AWS
  -source string
    	path of files to upload (default ".")
  -try
    	trial run, no remote updates
  -v	enable verbose logging
  -workers int
    	number of workers to upload files (default -1)

Notes

  • The key and secret command flags can also be set with environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  • The region flag is the AWS API name for the region where your bucket resides. See the table below or the AWS Regions documentation file for an up-to-date version.
Bucket region API value Bucket region API value
Canada (Central) ca-central-1 Asia Pacific (Mumbai) ap-south-1
US East (Ohio) us-east-2 Asia Pacific (Seoul) ap-northeast-2
US East (N. Virginia) us-east-1 Asia Pacific (Singapore) ap-southeast-1
US West (N. California) us-west-1 Asia Pacific (Sydney) ap-southeast-2
US West (Oregon) us-west-2 Asia Pacific (Tokyo) ap-northeast-1
EU (Frankfurt) eu-central-1 China (Beijing) cn-north-1
EU (Ireland) eu-west-1 China (Ningxia) cn-northwest-1
EU (London) eu-west-2
EU (Paris) eu-west-3
South America (São Paulo) sa-east-1

Global AWS Configuration

See https://docs.aws.amazon.com/sdk-for-go/api/aws/session/#hdr-Sessions_from_Shared_Config

The AWS SDK will fall back to credentials from ~/.aws/credentials.

If you set the AWS_SDK_LOAD_CONFIG enviroment variable, it will also load shared config from ~/.aws/config where you can set the global region to use if not provided etc.

Advanced Configuration

Add a .s3deploy.yml configuration file in the root of your site. Example configuration:

routes:
    - route: "^.+\\.(js|css|svg|ttf)$"
      #  cache static assets for 20 years
      headers:
         Cache-Control: "max-age=630720000, no-transform, public"
      gzip: true
    - route: "^.+\\.(png|jpg)$"
      headers:
         Cache-Control: "max-age=630720000, no-transform, public"
      gzip: false
    - route: "^.+\\.(html|xml|json)$"
      gzip: true

Example IAM Policy

{
   "Version": "2012-10-17",
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "s3:ListBucket",
            "s3:GetBucketLocation"
         ],
         "Resource":"arn:aws:s3:::<bucketname>"
      },
      {
         "Effect":"Allow",
         "Action":[
            "s3:PutObject",
            "s3:PutObjectAcl",
            "s3:DeleteObject"
         ],
         "Resource":"arn:aws:s3:::<bucketname>/*"
      }
   ]
}

Replace with your own.

CloudFront CDN Cache Invalidation

If you have configured CloudFront CDN in front of your S3 bucket, you can supply the distribution-id as a flag. This will make sure to invalidate the cache for the updated files after the deployment to S3. Note that the AWS user must have the needed access rights.

Note that CloudFront allows 1,000 paths per month at no charge, so S3deploy tries to be smart about the invalidation strategy; we try to reduce the number of paths to 8. If that isn't possible, we will fall back to a full invalidation, e.g. "/*".

Example IAM Policy With CloudFront Config

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetBucketLocation"
            ],
            "Resource": "arn:aws:s3:::<bucketname>"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:DeleteObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::<bucketname>/*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "cloudfront:GetDistribution",
                "cloudfront:CreateInvalidation"
            ],
            "Resource": "*"
        }
    ]
}

Background Information

If you're looking at s3deploy then you've probably already seen the aws s3 sync command - this command has a sync-strategy that is not optimised for static sites, it compares the timestamp and size of your files to decide whether to upload the file.

Because static-site generators can recreate every file (even if identical) the timestamp is updated and thus aws s3 sync will needlessly upload every single file. s3deploy on the other hand checks the etag hash to check for actual changes, and uses that instead.

Alternatives

  • go3up by Alexandru Ungur
  • s3up by Nathan Youngman (the starting-point of this project)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].