Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/k1low/serverless-static-hosting-with-basic-auth

Serverless boilerplate for Static website hosting with Basic authentication
https://github.com/k1low/serverless-static-hosting-with-basic-auth

basic-authentication biolerplate serverless static-hosting

Last synced: about 1 month ago
JSON representation

Serverless boilerplate for Static website hosting with Basic authentication

Awesome Lists containing this project

README

        

# Serverless boilerplate for Static website hosting with Basic authentication [![Build Status](https://travis-ci.org/k1LoW/serverless-static-hosting-with-basic-auth.svg?branch=master)](https://travis-ci.org/k1LoW/serverless-static-hosting-with-basic-auth)

## Architecture

```
[CloudFront (with Lambda@Edge)] -Restrict Bucket Access-> [S3 Origin Bucket] <-Sync- [Local src/*]
```

### Using plugin

- [serverless-plugin-cloudfront-lambda-edge](https://github.com/silvermine/serverless-plugin-cloudfront-lambda-edge)
- [serverless-s3-sync](https://github.com/k1LoW/serverless-s3-sync)

## Usage

### Install boilerplate

```
$ git clone https://github.com/k1LoW/serverless-static-hosting-with-basic-auth.git ./my-static-page
```

### Set Basic authentication USERNAME:PASS

Set Basic authentication config ( `handler.js` )

### Deploy stack

```
$ npm install
$ AWS_PROFILE=XxxxxXXX WEBSITE_S3_BUCKET_NAME=sls-static-basic npm run deploy
```

### Synchronize src/* -> Website

```
$ AWS_PROFILE=XxxxxXXX WEBSITE_S3_BUCKET_NAME=sls-static-basic npm run sync
```

### Remove stack

```
$ AWS_PROFILE=XxxxxXXX WEBSITE_S3_BUCKET_NAME=sls-static-basic npm run remove
```