This example shows, how to use AWS JavaScript (Browser) SDK to upload files from Frontend to S3 bucket (as opposite to traditional PHP bancked handling all uploaded files)
- Have an AWS Account
- (Prefered) Create user with
AdministratorAccess
managed policy (or less). Then replacearn:aws:iam::${AWS::AccountId}:root
with your user ARN (cat be fetched byaws sts get-caller-identity
or by from AWS Web interface) - Install and configure AWS CLI
- Create AWS Cloud Formation stack from
s3uploader-cf.yml
template. - Use Ouptut (there is a tab in AWS Web UI) to get
bucket
name and example to use foraws sts assume-role
- Update
index.html
to use your createdbucket
andAWS.Credentials
- Open file
index.html
via browser and try to upload something (errors are logged into Broser's Console) - To be confident, files should be stored to AWS S3 bucket in your account (name of the bucket is autogenerated)
- Oficial example: https://aws.amazon.com/developers/getting-started/browser/
- Original example during the talk: https://aurelijus.banelis.lt/prezentations/vilniusphp0x52/index.html
- Slides of the talk: https://aurelijus.banelis.lt/prezentations/vilniusphp-2019/aws-security-v1.pdf