#aws-iot #aws #iot #edge

bin+lib aws-greengrass-nucleus

aws greengrass nucleus in Rust (unofficial)

6 releases

0.0.7 Sep 16, 2022
0.0.6 Sep 16, 2022
0.0.3 Jul 29, 2022
0.0.2 Mar 7, 2022

#377 in Embedded development

MIT license

480KB
980 lines

aws-greengrass-nucleus-rust

crates.io page

aws greengrass nucleus in Rust programming language (unofficial)

Motivation


What I cannot create, I do not understand.

Know how to solve every problem that has been solved.

                                  ————  Richard Feynman 

on his blackboard at the time of death in February 1988;


Quickstart

  1. cargo run -- --version
aws-greengrass-nucleus 0.0.3
  1. cargo run -- --help
aws-greengrass-nucleus 0.0.3
aws greengrass nucleus in Rust (unofficial)

USAGE:
    aws-greengrass-nucleus [OPTIONS] --thing-name <THING_NAME>

OPTIONS:
        --aws-region <AWS_REGION>
            [default: ap-southeast-1]

        --component-default-user <COMPONENT_DEFAULT_USER>
            

        --deploy-dev-tools
        ...
  1. cargo run -- --aws-region ap-southeast-1 --thing-name coreName --component-default-user ggc_user:ggc_group --provision
same as original nucleus

Nucleus

The Greengrass nucleus component (aws.greengrass.Nucleus) is a mandatory component and the minimum requirement to run the AWS IoT Greengrass Core software on a device.

a little bit of history

How big?

v1 (maybe golang?)

- Minimum 128 MB disk space available for the AWS IoT Greengrass Core software. If you use the OTA update agent, the minimum is 400 MB.

- Minimum 128 MB RAM allocated to the AWS IoT Greengrass Core software. With stream manager enabled, the minimum is 198 MB RAM.

v2 (open source in Java)

- memory,
The maximum amount of RAM (in kilobytes) that each component's processes can use on the core device.

How v2 works?

Greengrass v2 CLI

core-device:

  • list-core-devices
  • get-core-device
  • delete-core-device

component:

  • create-component-version
  • describe-component
  • delete-component
  • get-component
  • get-component-version-artifact
  • list-component-versions
  • list-components
  • resolve-component-candidates

deployments:

  • create-deployment
  • list-deployments
  • get-deployment
  • cancel-deployment

misc:

  • list-effective-deployments
  • list-installed-components
  • list-tags-for-resource
  • tag-resource
  • untag-resource

How to

  • open documentation:

cargo doc --open

  • Compile local packages and all of their dependencies:

cargo b(uild)

  • Release build:

cargo b --release

  • Cross-compile:

rustup target list rustup target add cargo b --target <>

  • Cross-compile for Raspberry:

https://robamu.github.io/post/cross-compile-rust-rpi/

  • Cross-compile for OpenWRT:

https://blog.dend.ro/building-rust-for-routers/

  • Fast check:

cargo c(heck)

  • Run:

cargo run (-- your-args)

  • Test:

cargo test

  • Documentation tests:

https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#documentation-tests

  • Publish:

cargo publish

Design

see docs/design.md

Use case

The following example shows how an AWS IoT Greengrass device interacts with the AWS IoT Greengrass cloud service and other AWS services in the AWS Cloud. example

Dependencies

~72MB
~1M SLoC