Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kfei <kfei@kfei.net>
- Loading branch information
Showing
2 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# vue-s3-dropzone | ||
|
||
> Vue 2.0 dropzone component uploads files to AWS S3 serverlessly. | ||
## Overview | ||
|
||
- A Vue.js 2.0 component wrapping [Dropzone.js](https://github.com/enyo/dropzone) | ||
- Upload files to AWS S3 *serverlessly* with AWS Lambda. | ||
|
||
## Demo | ||
|
||
![demo-gif](https://i.giphy.com/3oriNVluNp8DmKgvFS.gif) | ||
|
||
## Quickstart | ||
|
||
Clone this repo: | ||
|
||
``` | ||
git clone https://github.com/kfei/vue-s3-dropzone | ||
``` | ||
|
||
This repo contains two directories: **frontend** and **lambda**. You must first | ||
create the AWS Lambda function and deploy it onto AWS API Gateway. Then put the | ||
invoke URL into `frontend/src/config.js` so that you can run and test the Vue | ||
powered web client by: | ||
|
||
``` | ||
cd frontend | ||
yarn install | ||
npm run dev | ||
``` | ||
|
||
Please make sure you have correct priviledge/policy/CORS settings on AWS. Feel | ||
free to open an issue if you happened to be trapped by that. :cry: | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
#### References | ||
## Quickstart | ||
|
||
- http://stackoverflow.com/q/21452756 | ||
- https://github.com/danialfarid/ng-file-upload/issues/743 | ||
- https://github.com/Sam-Martin/aws-image-upload-without-ec2 | ||
1. create a blank AWS Lambda function | ||
2. choose Node 4.3 runtime | ||
3. paste the code in `GetSignedURL.js` to the Lambda function code | ||
4. add an env variable `AWS_BUCKET_NAME` with value equals to your S3 bucket | ||
name | ||
5. create an API on AWS API Gateway to trigger the Lambda function | ||
6. deploy the API | ||
7. done | ||
|
||
## Hints | ||
- the role of the Lambda function should have the correct permission on your | ||
S3 bucket | ||
- you should enable CORS and have a correct setting both in API Gateway and | ||
S3 bucket |