筆記未完待補
AWS Lambda
Choose Microservice from blueprints
In security: choose ’open’, and next
type your lambda function name and ’create a new role.’ Enter a role name.
Create lambda functino
Needed headers in lambda code:
’Access-Control-Allow-Headers’: ’Content-Type,X-Amz-Date,Authorization’,
’Access-Control-Allow-Methods’: ’GET,POST,PUT,DELETE’,
’Access-Control-Allow-Origin’: ’*’
AWS API GATEWAY
To solve ’access-control-allow-origin problem’
’Enable CORS’
and add the above "access-control..." to your lambda code
AWS DynamoDB
create Table: choose a primary key (like userId) and a sort key
AWS S3
To deploy your site, use webpack to build your bundle by either ’node_modules/.bin/webpack’ or ’npm run build’
Then upload your two files in ./build folder: index.html and bundle.js to a S3 bucket.
In the bucket settings, choose ’Enable static website hosting’ and type index.html into the index document box.
Also, choose the two uploaded files, and in ’Actions’ choose ’Make Public’
Results
Deployed address
http://g0v-example-workshop.s3-website-us-east-1.amazonaws.com/
Workshop Github source