Question about program language of AWS IoT Greengrass

0

From AWS IoT Greengrass FAQs, it said AWS IoT Greengrass discovery is available on the AWS IoT Device SDK via C++, Node.js, Java, and Python 2.7, 3.7, and 3.8.

However, my application is used JavaScript and React. Then, I found aws.greengrass.labs.LocalWebServer. Is it possible for me to use this aws.greengrass.labs.LocalWebServer deploy the application on Greengrass.

Rather than this aws.greengrass.labs.LocalWebServer, do I have another way to deploy my application on AWS IoT Greengrass?

P.S. I am using Ubuntu, but I am unable to download docker.

Thank you very much!

已提问 1 年前344 查看次数
1 回答
0

Hi,

You can follow these steps to run your react app in Greengrass, assuming you have node installed on the device:

  1. Build your react app with npm run build,
  2. zip the content of the build folder and upload it to s3://<bucket>/com.example.ReactApp/build.zip.
  3. 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
  1. 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

AWS
专家
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则