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!

gefragt vor einem Jahr343 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen