1 Answer
- Newest
- Most votes
- Most comments
0
Hi,
You can follow these steps to run your react app in Greengrass, assuming you have node
installed on the device:
- Build your react app with
npm run build
, - zip the content of the
build
folder and upload it tos3://<bucket>/com.example.ReactApp/build.zip
. - create a component with the following recipe
RecipeFormatVersion: 2020-01-25 ComponentName: com.example.ReactApp ComponentVersion: 1.0.7 ComponentDescription: "" ComponentPublisher: Amazon ComponentDependencies: {} Manifests: - Platform: os: /linux/ architecture: /x86|aarch64|amd64|arm/ Lifecycle: Install: |- npm init -y npm install live-server Run: Script: node node_modules/live-server/live-server.js {artifacts:decompressedPath}/build Artifacts: - Uri: s3://<bucket>/com.example.ReactApp/build.zip Unarchive: ZIP
- deploy the component to your device
live-server
(or SimpleHTTPServer
in Python) are not suitable for production workloads but work fine for development and experimentation.
For a more robust serving of your application, consider using NGINX or httpd
.
Cheers,
Massimiliano
Relevant content
- Accepted Answerasked 4 years ago
- asked 2 years ago
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 9 months ago
Hello,
Thank you for your answer. After I do step 3, the Deployment status failed.
Then, I went to check my IAM permission, I have already chosen the AmazonS3FullAccess.
How can I solve this problem?
Again, thank you for your answer.
The role associated to your Greengrass core device (by default it is https://us-east-1.console.aws.amazon.com/iamv2/home#/roles/details/GreengrassV2TokenExchangeRole?section=permissions) should have the permissions
s3:GetObject
ands3:GetBucketLocation
as explained in Allow access to S3 buckets in the Greengrass documentationHi,
Thank you for your answer! Sorry that I have one more question. May I ask how to use live-server?
Thank you!