简体   繁体   中英

how can I deploy a react app in aws lambda serverless or S3

I created a new react project that reads and writes the files on S3 every minute to generate the data on the page. I want to deploy it on aws lambda or S3 serverless service. I checked a lot of documents and didn't find the tutorial I wanted. Can I achieve the above requirements?

Yes it can be done, you need to setup the IAM role/user policy ( serverless-admin ) and the permissions to read/write from S3 bucket. Suggest you set up the aws-cli tool - https://aws.amazon.com/cli/

You will need to setup an aws profile after installing the tool. https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

And next Use the serverless framework, https://serverless-stack.com/ to deploy your reactjs applications - This will simplify the process. Follow the tutorial, it will help in understanding the process clearly. I have just done the same, deployed a react js to read/write from a variety of aws services including S3 buckets.

Deploy by running the command on the terminal - AWS_PROFILE=serverless-admin sls deploy -v --aws-profile=serverless-admin

Updates to the code can be deployed using -

AWS_PROFILE=serverless-admin sls deploy function -f hello  --aws-profile=serverless-admin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM