Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add learning path using AWS IoT Greengrass to deploy apps on AVH #381

Merged
merged 1 commit into from Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions content/learning-paths/embedded-systems/avh_greengrass/2setup.md
@@ -0,0 +1,36 @@
---
title: Setup your AWS IoT Greengrass account
weight: 2

### FIXED, DO NOT MODIFY
layout: learningpathall
---

## Before you begin

You will need a user account for [Arm Virtual Hardware 3rd Party Hardware](https://avh.arm.com/). Refer to [Arm Virtual Hardware install guide](/install-guides/avh#thirdparty) for more information.

You will also need a user account for [Amazon AWS](https://aws.amazon.com). This service requires a credit card to use, but this tutorial will only use resources that fall under the free tier, so you can follow along without paying anything.

## Create a Device

From the AVH dashboard, click on the `Create Device` button. You will be presented with a list of devices to choose from, for this tutorial we are using a Raspberry Pi 4, so select that device.

![create device](./create_device.png)

On the next screen you will be asked to configure your device by choosing the firmware to use. AWS IoT Greengrass Core will run on either the Ubuntu Server or Raspberry Pi OS firmware images. For this tutorial we will be using the Ubuntu Server firmware. Select that and click `Next`.

The last step is to give your new AVH device a unique name. You can use whatever you'd like, or go with `greengrass-testing-device` for this tutorial. You do not need to set any advances boot options.

![device ready](device_ready.png)

Once the device creation is complete, log in with the default username `pi` and password `raspberry`.

You are now ready to install AWS IoT Greengrass Core onto your virtual Raspberry Pi.

## Install AWS IoT Greengrass Core

AWS IoT Greengrass Core is the software component that runs on your IoT devices. You will need to install and configure it on your new AVH device, using the console provided by AVH or over an SSH connection.

Follow the [AWS IoT Greengrass install guide](../../../install-guides/aws-greengrass-v2.md) to finish setting up your device.

66 changes: 66 additions & 0 deletions content/learning-paths/embedded-systems/avh_greengrass/3deploy.md
@@ -0,0 +1,66 @@
---
title: Deploy an AWS IoT Greengrass component to your device
weight: 3

### FIXED, DO NOT MODIFY
layout: learningpathall
---

## Create a new Greengrass Deployment

In AWS IoT Greengrass you manage your set of applications (called Components) in what they call a Deployment. You define a Deployment as a set of Components and their configurations. Deployments can be revises to change configurations or add/remove components.

![deployments screen](gg_deployments.png)

In the AWS IoT console, navigate to `Manage -> Greengrass devices -> Deployments` on the right-side navigation, then click the `Create` button to start a new Greengrass deployment.

![create deployment screen](gg_create_deployment.png)

Call you deployment `AVH-Testing` and for the Deployment Target select `Thing group` and the `MyGreengrassCoreGroup` that was created when you followed the AWS IoT Greengrass Install Guide.

![select components screen](gg_select_components.png)

The next step is to select which Components should be in your Deployment. For this tutorial we are going to keep it simple and deploy the AWS Greengrass CLI (which is different from the AWS CLI) onto our virtual device. In the Public Components section, search for `CLI` and then select `aws.greengrass.Cli` from the list.

There is no configuration you need to do for the AWS Greengrass CLI component, so you can skip the next couple of screens until you get to the `Review` step. Here you can verify your component selection and deployment target before clicking the `Deploy` button.

## Verify your deployment

After deploying you will be redirected to your `AVH-Testing` deployment page.

![deployment overview](gg_deployment_overview.png)

After a moment you should see that the deployment to your `MyGreengrassCore` device was successful.

![device components](gg_device_components.png)

Clicking on that device will now show you a list of installed and running Components.

Finally, return to your AVH console and run the AWS Greengrass CLI

```bash { target="ubuntu:latest" command_line="pi@ubuntu:~$ | 2-15"}
/greengrass/v2/bin/greengrass-cli --help
Usage: greengrass-cli [-hV] [--ggcRootPath=<ggcRootPath>] [COMMAND]
Greengrass command line interface

--ggcRootPath=<ggcRootPath>
The AWS IoT Greengrass V2 root directory.
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
help Show help information for a command.
component Retrieve component information and stop or restart components.
deployment Create local deployments and retrieve deployment status.
logs Analyze Greengrass logs.
get-debug-password Generate a password for use with the HTTP debug view component.
pubsub Publish or subscribe to local topic.
iotcore Publish or subscribe to IoT Core.
```

## Revising your deployment

This is only the first revision of your Deployment. Going forward you can add more Components, remove the Greengrass CLI component, and change configurations by simply revising your `AVH-Testing` deployment.

![revise a deployment](gg_revise_deployment.png)

When you create a new revision of your deployment, the new Components and configurations will be automatically deployed to every device in your deployment simultaneously.
37 changes: 37 additions & 0 deletions content/learning-paths/embedded-systems/avh_greengrass/_index.md
@@ -0,0 +1,37 @@
---
title: Deploy IoT apps using AWS IoT Greengrass with Arm Virtual Hardware

description: Learn how to deploy applications from the Balena Hub onto Arm Virtual Hardware

minutes_to_complete: 30

who_is_this_for: This is an introductory topic for embedded software developers new to AWS IoT Greengrass.

learning_objectives:
- Instantiate Arm Virtual Hardware instances
- Deploy pre-built AWS IoT Greengrass components on Arm Virtual Hardware

prerequisites:
- An account on [Amazon AWS](https://aws.amazon.com.com)
- Some familiarity with embedded programming is assumed

author_primary: Michael Hall

### Tags
skilllevels: Introductory
subjects: Embedded Linux
armips:
- Cortex-A
operatingsystems:
- Linux
tools:
- Arm Virtual Hardware
- AWS IoT Greengrass


### FIXED, DO NOT MODIFY
# ================================================================================
weight: 1 # _index.md always has weight of 1 to order correctly
layout: "learningpathall" # All files under learning paths have this same wrapper
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
---
@@ -0,0 +1,27 @@
---
next_step_guidance: You now have the beginnings of a group of virtual IoT devices and the ability to deploy and manage applications to them. Try out other public AWS Greengrass components by revising your deployment, or create your own custom AWS Greengrass components.

recommended_path: /learning-paths/embedded-systems

further_reading:
- resource:
title: AWS IoT Greengrass CLI documentation
link: https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-cli-component.html
type: documentation
- resource:
title: Develop AWS IoT Greengrass components
link: https://docs.aws.amazon.com/greengrass/v2/developerguide/develop-greengrass-components.html
type: documentation
- resource:
title: AWS IoT Greengrass v2 Developer Guide
link: https://docs.aws.amazon.com/greengrass/v2/developerguide/what-is-iot-greengrass.html
type: website


# ================================================================================
# FIXED, DO NOT MODIFY
# ================================================================================
weight: 21 # set to always be larger than the content in this path, and one more than 'review'
title: "Next Steps" # Always the same
layout: "learningpathall" # All files under learning paths have this same wrapper
---
47 changes: 47 additions & 0 deletions content/learning-paths/embedded-systems/avh_greengrass/_review.md
@@ -0,0 +1,47 @@
---
review:
- questions:
question: >
What is an application in AWS IoT Greegrass called?
answers:
- App
- Block
- Component
- Package
correct_answer: 3
explanation: >
Applications in AWS IoT Greengrass are referred to as "Components".

- questions:
question: >
What is a collection of components and configurations in AWS IoT Greengrass called?
answers:
- Container
- Deployment
- Fleet
- Image
correct_answer: 2
explanation: >
Sets of applications (or Components) are referred to as "Deployments".

- questions:
question: >
How can you change what components or configurations are in your deployment?
answers:
- Delete the current deployment and create a new one
- Create a new deployment alongside your existing one
- Revise your existing deployment with new components
- You can not modify a deployment
correct_answer: 3
explanation: >
AWS IoT Greengrass lets you revise your existing deployments to change configurations or add/remove components.



# ================================================================================
# FIXED, DO NOT MODIFY
# ================================================================================
title: "Review" # Always the same title
weight: 20 # Set to always be larger than the content in this path
layout: "learningpathall" # All files under learning paths have this same wrapper
---
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.