Scotty.js - コマンド一つでS3/CloudFrontへのアップロード
簡単なWebサイトや静的サイトをAmazon S3上で公開するケースが増えています。さらに表示を高速化したり、SSL/TLSを使うためにCloudFrontを使うケースも増えています。しかしそのアップロード法は今なおFTP並のやり方のことも多いでしょう。 そこで使ってみたいのがScotty.jsです。コマンド一つでアップロードからCloudFrontを使った公開まで行ってくれます。
Scotty.jsの使い方
実行したところです。バケットの作成とファイルアップロード、CloudFrontを使った公開まで一手に行ってくれます。
$ scotty --website --bucket demo.moongift.jp
create ✤ /demo.moongift.jp bucket
bucket ✤ demo.moongift.jp
upload ✤ completed (102b, 0.72s)
config ✤ set as a website
config ✤ set cdn
Scotty.jsのオプションです。
$ scotty --help
Scotty ✤ deploy static websites or folders to AWS S3 with a single command
Version: 1.6.0
✤ ✤ ✤
USAGE:
scotty {options} or beam-me-up {options}
AVAILABLE OPTIONS:
--help or -h Print this help
--version or -v Print the current version
--quiet or -q Suppress output when executing commands | default: false
--website or -w Set uploaded folder as a static website | default: false
--spa Set uploaded folder as a single page app and redirect all non-existing pages to index.html | default: false
--source or -s Source of the folder that will be uploaded | default: current folder
--bucket or -b Name of the S3 bucket | default: name of the current folder
--region or -r AWS region where the files will be uploaded | default: saved region if exists or a list to choose one if it is not saved yet
--force or -f Update the bucket without asking, region can be overridden with -r | default: false
--update or -u Update existing bucket | default: false
--delete or -d Delete existing bucket | default: false
✤ ✤ ✤
Beam me up, Scotty!
More info: https://github.com/stojanovic/scottyjs
Changelog/release history: https://github.com/stojanovic/scottyjs/releases
Scotty.jsではS3とCloudFrontの操作権限が必要になります。初回はリージョンも聞かれます。 --spa
を付けるとWebアプリケーションモードになり、アクセス先ファイルがない場合にすべて index.html が読み込まれるようになります。
Scotty.jsはJavaScript製のオープンソース・ソフトウェア(MIT License)です。