FineUploader configuration
-
Create bucket in Amazon
-
Create a bucket policy / or edit existing
{ "Version": "2008-10-17", "Statement": [ { "Sid": "Stmt1397069460111", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "s3:*", "Resource": "arn:aws:s3:::trivids_streaming/*" } ] }
For upload only, change Action statement to s3:putObject
To restrict to a certain user, change Principal tag: e.g.: "AWS":"arn:aws:iam::147272306770:user/username"
-
Edit CORS configuration
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <ExposeHeader>ETag</ExposeHeader> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>
Can restrict access by changing the parameter for AllowedOrigin - I think this is domain specific
-
Create IAM group / user a. Create group first b. Create permissions policy
{ "Version":"2012-10-17", "Statement":[{ "Effect":"Allow", "Action":"s3:PutObject", "Resource":"arn:aws:s3:::[your_bucket_name]/*" }] }
c. create user (select "users" in left sidebar menu)
d. show user security credentials; download credentials as we can't get secret key again for that user
e. add user to group
f. use policy generator - select
AWS Service: Amazon S3 Actions: DeleteObject, GetObject and PutObject Amazon Resource Name: arn:aws:s3:::[your_bucket_name]/* click "add stement" click "continue" click "apply policy"
-
Clone fine uploader repo onto your machine
"git clone https://github.com/Widen/fine-uploader.git"
-
Add node.js to your server if it's not already installed
Install the dependencies:
$ sudo apt-get install g++ curl libssl-dev apache2-utils $ sudo apt-get install git-core (unless you already have it)
Run the following commands:
$ git clone git://github.com/ry/node.git $ cd node $ ./configure $ make $ sudo make install
-
Navigate into the fine-uploader directory
-
npm install
-
Install grunt: sudo npm install -g grunt-cli
-
grunt build
-
Compiled files are in fine-uploader/_build
-
Move the contents of this repo onto your server
-
Get AWS-SDK
a. git clone https://github.com/amazonwebservices/aws-sdk-for-php.git
b. mv aws-sdk-for-php aws
c. mv aws (into the folder from #12 so that it's even with index.html)
-
Customize index.html
a. endpoint: replace with your bucket (e.g. [your_bucket_name].s3.amazonaws.com)
b. accessKey: replace with Access Key ID from credentials you downloaded in step 4-d
c. edit s3/sign.php
i. Replace $serverPrivateKey with Secret Access Key downloaded in step 4-d ii. Replace $serverPublicKey with Access Key Id downloaded in step 4-d iii. Replace $expectedBucketName with bucket (e.g. [your_bucket_name]) iv. Edit $expectedMaxSize if necessary
-
Move stylesheet from _build folder so that it's even with index.html