Difference between revisions of "R-Car/Boards/Yocto-Gen3/AWS IoT Greengrass/v5.5.0"

From eLinux.org
Jump to: navigation, search
 
(33 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== はじめに ==
+
{{Template:R-Car-Gen3-Navbox}}
このページは、 R-Car にて AWS GreenGlass を使用するための、Yocto環境の構築および実行手順を記載している。
+
{{TOC right}}
 +
 
 +
[[Category:R-Car]]
 +
[[Category:R-Car Gen3]]
 +
 
 +
== Introduction ==
 +
This page describes how to setup the Yocto environment to use the AWS IoT Greengrass with R-Car and run it.
 +
 
 +
This page contains information abot building and running AWS IoT Greengrass on Yocto environment on:
 +
* [[R-Car/Boards/H3SK | Renesas R-Car-H3 Starter Kit Premier]] (unofficial name - H3ULCB)
 +
* [[R-Car/Boards/M3SK | Renesas R-Car-M3 Starter Kit Pro]] (unofficial name - M3ULCB)
 +
** https://www.renesas.com/us/en/products/automotive-products/automotive-system-chips-socs/r-car-h3-m3-starter-kit
 +
* [[R-Car/Boards/CCPF-SK]]
 +
** http://www.shimafuji.co.jp/products/2308
 +
 
 +
== Topic ==
 +
{{Template:R-Car-Gen3-Topic}}
 +
 
 +
== Software revisions ==
  
== 環境 ==
+
{| class="wikitable"
=== ビルドPC ===
+
|-
 +
! Software !! Revision
 +
|-
 +
| Yocto Project || [https://git.yoctoproject.org/poky/tag/?id=yocto-3.1.8 3.1.8]
 +
|-
 +
| aarch64-poky-linux-gcc (GCC) || 9.3
 +
|-
 +
| Kernel Ver || 5.10.41
 +
|-
 +
| Userland 64/32bit || 64
 +
|-
 +
| U-Boot || 2020.10
 +
|-
 +
| OP_TEE || 3.13.0
 +
|-
 +
| Greengrass || 2.4.0
 +
|-
 +
|}
 +
 
 +
== Environment ==
 +
=== Host PC ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
| OS || Ubuntu 20.04 LTS (64bit)
 
| OS || Ubuntu 20.04 LTS (64bit)
 
|-  
 
|-  
| メモリ || 8 GB 以上
+
| Memory || 8 GB or more
 
|-  
 
|-  
| ストレージ || 空き 100 GB 以上
+
| Storage || At least 100 GB free
 
|-  
 
|-  
 
|}
 
|}
=== 確認済みボード ===
+
=== Boards confirmed to work ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Board !! SoC !! Confirmed
 
! Board !! SoC !! Confirmed
 
|-
 
|-
| R-Car Starter Kit Premier || H3 v2.0 || OK
+
| R-Car Starter Kit Premier(H3) || H3e-2G v3.0 || OK
 +
|-
 +
| R-Car Starter Kit Premier(H3) || H3 v3.0 (1rank DDR) || OK
 +
|-
 +
| R-Car Starter Kit Premier(H3) || H3 v3.0 (2rank DDR) || NT
 +
|-
 +
| R-Car Starter Kit Premier(H3) || H3 v2.0 with 4GB DDR || OK
 
|-  
 
|-  
| CCPF + R-Car Starter Kit Premier || H3 v2.0 || OK
+
| R-Car Starter Kit Pro || M3 v3.0 || OK
 
|-  
 
|-  
 
| R-Car Starter Kit Pro || M3 v1.0 || OK
 
| R-Car Starter Kit Pro || M3 v1.0 || OK
 
|-  
 
|-  
| R-Car Starter Kit Pro || M3 v3.0 || OK
+
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3e-2G v3.0 || OK
 +
|-
 +
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3 v3.0 (1rank DDR) || OK
 +
|-
 +
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3 v3.0 (2rank DDR) || NT
 +
|-
 +
| CCPF-SK + R-Car Starter Kit Premier(H3) || H3 v2.0 with 4GB DDR || OK
 
|-  
 
|-  
| CCPF + R-Car Starter Kit Pro || M3 v1.0 || OK
+
| CCPF-SK + R-Car Starter Kit Pro || M3 v3.0 || OK
 
|-  
 
|-  
| CCPF + R-Car Starter Kit Pro || M3 v3.0 || OK
+
| CCPF-SK + R-Car Starter Kit Pro || M3 v1.0 || OK
 
|-  
 
|-  
 
|}
 
|}
 +
{{Note}} NT='Not Tested' but will work
 +
 +
See also:
 +
* [[R-Car/Boards/H3SK#Hardware]]
 +
* [[R-Car/Boards/M3SK#Hardware]]
 +
 +
== Required packages ==
  
== ビルド手順 ==
+
# Install required packages
# 事前準備(パッケージのインストール)
 
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
 
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
Line 40: Line 96:
 
libsdl1.2-dev pylint3 xterm docker.io
 
libsdl1.2-dev pylint3 xterm docker.io
 
</syntaxhighlight>
 
</syntaxhighlight>
# gitの設定
+
#: Refer to [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html#packages Yocto Project Quick Start] for more information.
 +
#: {{Note}}If the OS version of the host PC is earlier than "Ubuntu 20.04", the default gcc version is old, so use "gcc-9/g++-9" or later version.
 +
 
 +
# Set up initial git configuration
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ git config --global user.email "you@example.com"
 
$ git config --global user.email "you@example.com"
 
$ git config --global user.name "Your Name"
 
$ git config --global user.name "Your Name"
 
</syntaxhighlight>
 
</syntaxhighlight>
# ビルドスクリプトを任意のディレクトリに作成
+
 
#: {{Note}}ビルドスクリプトはボードにCCPFが付いている場合とついていない場合で違うため、注意すること
+
== Building the BSP ==
#: <br>
+
# Create the following script(build.sh) for building
#: '''H3SK / M3SK の場合の build.sh'''
 
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
#!/bin/bash
 
#!/bin/bash
  
BOARD_LIST=("h3ulcb" "m3ulcb")
+
BOARD_LIST=("h3ulcb" "m3ulcb" "h3ulcb-ccpf-sk" "m3ulcb-ccpf-sk")
 
TARGET_BOARD=$1
 
TARGET_BOARD=$1
 
WORK=`pwd`/${TARGET_BOARD}
 
WORK=`pwd`/${TARGET_BOARD}
Line 60: Line 118:
 
META_OE_COMMIT=c38d2a74f762a792046f3d3c377827b08aade513
 
META_OE_COMMIT=c38d2a74f762a792046f3d3c377827b08aade513
 
META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
 
META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
META_VIRTUALIZATION_COMMIT=92cd3467502bd27b98a76862ca6525ce425a8479
+
META_RENESAS_CCPF_COMMIT=b49b57d6e68d5cda70aefbed34e06903484c573b
 +
META_VIRTUALIZATION_COMMIT=c4f156fa93b37b2428e09ae22dbd7f5875606f4d
 
META_JAVA_COMMIT=62d6c0653ad69e14c21db2d4482e578400116a1b
 
META_JAVA_COMMIT=62d6c0653ad69e14c21db2d4482e578400116a1b
 
META_AWS_COMMIT=09a9e8845e1c0685d279a5fec12dc2764e67675c
 
META_AWS_COMMIT=09a9e8845e1c0685d279a5fec12dc2764e67675c
 
META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
 
META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
META_YOCTO_TEMPLATECONF_COMMIT=0bd105ad8247bfdd4835c5e90ee4eab6242f9607
 
  
 
Usage () {
 
Usage () {
Line 89: Line 147:
 
git clone git://github.com/aws/meta-aws &
 
git clone git://github.com/aws/meta-aws &
 
git clone git://github.com/tkomagata/meta-docker &
 
git clone git://github.com/tkomagata/meta-docker &
git clone git://github.com/tkomagata/yocto_templateconf &
+
if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
 +
    git clone git://github.com/renesas-rcar/meta-renesas-ccpf &
 +
fi
  
 
# Wait for all clone operations
 
# Wait for all clone operations
Line 109: Line 169:
 
cd ${WORK}/meta-docker
 
cd ${WORK}/meta-docker
 
git checkout -b tmp ${META_DOCKER_COMMIT}
 
git checkout -b tmp ${META_DOCKER_COMMIT}
cd ${WORK}/yocto_templateconf
+
if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
git checkout -b tmp ${META_YOCTO_TEMPLATECONF_COMMIT}
+
    cd ${WORK}/meta-renesas-ccpf
 +
    git checkout -b tmp ${META_RENESAS_CCPF_COMMIT}
 +
fi
  
TEMPLATECONF=${WORK}/yocto_templateconf/ggc/rcar-gen3/${TARGET_BOARD}/bsp/
+
if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
 +
    TEMPLATECONF=${WORK}/meta-renesas-ccpf/meta-rcar-gen3/docs/sample/conf/${TARGET_BOARD}/bsp/
 +
fi
  
 
cd ${WORK}
 
cd ${WORK}
 
source poky/oe-init-build-env ${WORK}/build
 
source poky/oe-init-build-env ${WORK}/build
 +
 +
if [ "${TARGET_BOARD}" = "h3ulcb" ] || [ "${TARGET_BOARD}" = "m3ulcb" ]; then
 +
    cp ${WORK}/meta-renesas/meta-rcar-gen3/docs/sample/conf/${TARGET_BOARD}/poky-gcc/bsp/bblayers.conf ${WORK}/build/conf/
 +
    cp ${WORK}/meta-renesas/meta-rcar-gen3/docs/sample/conf/${TARGET_BOARD}/poky-gcc/bsp/local.conf ${WORK}/build/conf/
 +
fi
 +
 +
bitbake-layers add-layer ../meta-openembedded/meta-networking
 +
bitbake-layers add-layer ../meta-openembedded/meta-filesystems
 +
bitbake-layers add-layer ../meta-virtualization
 +
bitbake-layers add-layer ../meta-docker/meta-rcar-gen3
 +
bitbake-layers add-layer ../meta-java
 +
bitbake-layers add-layer ../meta-aws
 
</syntaxhighlight>
 
</syntaxhighlight>
#: <br>
+
# Using setup script
#: '''CCPF+H3SK / CCPF+M3SK の場合の build.sh'''
 
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
#!/bin/bash
+
$ chmod a+x setup.sh
 
+
$ ./setup.sh <target_board_name>
BOARD_LIST=("h3ulcb" "m3ulcb")
+
</syntaxhighlight>
TARGET_BOARD=$1
+
#: target_board_name is specified for each board according to the following table:
WORK=`pwd`/${TARGET_BOARD}
+
#: [[File:R-car-sk-target-board-name.png|400px]]<br>
 
+
# Append the following to local configuration(<target_board_name>/build/conf/local.conf)
# Commit ID
+
#: <syntaxhighlight lang="bash">
POKY_COMMIT=6ebb33bdaccaeadff0c85aab27acf35723df00d8
+
# Docker presumes systemd
META_OE_COMMIT=c38d2a74f762a792046f3d3c377827b08aade513
+
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
+
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
META_RENESAS_CCPF_COMMIT=2e264bba92128dd6c3be68068673b1fd2d3e36e8
 
META_VIRTUALIZATION_COMMIT=92cd3467502bd27b98a76862ca6525ce425a8479
 
META_JAVA_COMMIT=62d6c0653ad69e14c21db2d4482e578400116a1b
 
META_AWS_COMMIT=09a9e8845e1c0685d279a5fec12dc2764e67675c
 
META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
 
META_YOCTO_TEMPLATECONF_COMMIT=0bd105ad8247bfdd4835c5e90ee4eab6242f9607
 
  
Usage () {
+
# add docker to the image
    echo "Usage: $0 \${TARGET_BOARD_NAME}"
+
DISTRO_FEATURES_append = " virtualization docker"
    echo "BOARD_NAME list: "
+
IMAGE_INSTALL_append = " docker"
    for i in ${BOARD_LIST[@]}; do echo " - $i"; done
+
CORE_IMAGE_EXTRA_INSTALL_append = " kernel-modules"
    exit
 
}
 
  
# Check Param.
+
# Add Greengrass and required packages to the image
if ! `IFS=$'\n'; echo "${BOARD_LIST[*]}" | grep -qx "${TARGET_BOARD}"`; then
+
IMAGE_INSTALL_append = " greengrass-bin texinfo sudo openjdk-8"
    Usage
+
EXTRA_IMAGE_FEATURES_append = " ssh-server-openssh"
fi
 
  
mkdir -p ${WORK}
+
# Possible provider: cacao-initial-native and jamvm-initial-native
cd ${WORK}
+
PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"
  
# Clone basic Yocto layers in parallel
+
# Possible provider: cacao-native and jamvm-native
git clone git://git.yoctoproject.org/poky &
+
PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
git clone git://git.openembedded.org/meta-openembedded &
 
git clone git://github.com/renesas-rcar/meta-renesas &
 
git clone git://github.com/renesas-rcar/meta-renesas-ccpf &
 
git clone git://git.yoctoproject.org/meta-virtualization &
 
git clone git://git.yoctoproject.org/meta-java &
 
git clone git://github.com/aws/meta-aws &
 
git clone git://github.com/tkomagata/meta-docker &
 
git clone git://github.com/tkomagata/yocto_templateconf &
 
 
 
# Wait for all clone operations
 
wait
 
 
 
# Switch to proper branches/commits
 
cd ${WORK}/poky
 
git checkout -b tmp ${POKY_COMMIT}
 
cd ${WORK}/meta-openembedded
 
git checkout -b tmp ${META_OE_COMMIT}
 
cd ${WORK}/meta-renesas
 
git checkout -b tmp ${META_RENESAS_COMMIT}
 
cd ${WORK}/meta-renesas-ccpf
 
git checkout -b tmp ${META_RENESAS_CCPF_COMMIT}
 
cd ${WORK}/meta-virtualization
 
git checkout -b tmp ${META_VIRTUALIZATION_COMMIT}
 
cd ${WORK}/meta-java
 
git checkout -b tmp ${META_JAVA_COMMIT}
 
cd ${WORK}/meta-aws
 
git checkout -b tmp ${META_AWS_COMMIT}
 
cd ${WORK}/meta-docker
 
git checkout -b tmp ${META_DOCKER_COMMIT}
 
cd ${WORK}/yocto_templateconf
 
git checkout -b tmp ${META_YOCTO_TEMPLATECONF_COMMIT}
 
  
TEMPLATECONF=${WORK}/yocto_templateconf/ggc/rcar-gen3/${TARGET_BOARD}/bsp/
+
# Optional since there is only one provider for now
 +
PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
  
cd ${WORK}
+
IMAGE_INSTALL_append = " python3-pip"
source poky/oe-init-build-env ${WORK}/build
 
</syntaxhighlight>
 
# ビルドスクリプトを実行
 
#: <syntaxhighlight lang="bash">
 
$ chmod a+x build.sh
 
$ ./build.sh <target_board_name>
 
</syntaxhighlight>
 
#: target_board_name は使用しているボードによって変える必要があるため、以下のように設定すること。
 
#: [[File:R-car-sk-target-board-name.png|400px]]<br>
 
# local.conf の修正
 
#: 以下を実行して、イメージに「python3-pip」のパッケージが含まれるようにコンフィグファイルを修正します。
 
#: <syntaxhighlight lang="bash">
 
$ echo "IMAGE_INSTALL_append = \" python3-pip\"" >> <target_board_name>/build/conf/local.conf
 
 
</syntaxhighlight>
 
</syntaxhighlight>
# ビルド実行
+
# Build
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ cd <target_board_name>
 
$ cd <target_board_name>
Line 209: Line 232:
 
$ bitbake core-image-minimal
 
$ bitbake core-image-minimal
 
</syntaxhighlight>
 
</syntaxhighlight>
#: イメージのビルドは、ホストシステムの性能によっては数時間かかることがある。
+
#: Depending on the performance of the host PC, it may take several hours for the build to complete.
#: ビルドが正常に完了すると、以下のような出力が表示される。
+
#: When the build completes successfully, you will see the following output:
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
-------------------------------------------
 
 
NOTE: Tasks Summary: Attempted 5383 tasks of which 5 didn't need to be rerun and all succeeded.
 
NOTE: Tasks Summary: Attempted 5383 tasks of which 5 didn't need to be rerun and all succeeded.
-------------------------------------------
 
 
</syntaxhighlight>
 
</syntaxhighlight>
# ビルド生成物
+
# Check the built images
#: bitbake を実行して生成されたファイルは以下に格納される
+
#: The built images are stored in the following:
 
#:  <target_board_name>/build/tmp/deploy/images/<target_board_name>/
 
#:  <target_board_name>/build/tmp/deploy/images/<target_board_name>/
# イメージを SD カードに書き込む
+
# Write the images to the SD card
#: SDカードにイメージを書き込む方法は、[[R-Car/Boards/Yocto-Gen3/v5.5.0#Loading_kernel_and_rootfs_via_eMMC.2FSD_card|Loading kernel and rootfs via eMMC/SD card]]を参照。
+
#: Write the images to the SD card with reference to [[R-Car/Boards/Yocto-Gen3/v5.5.0#Loading_kernel_and_rootfs_via_eMMC.2FSD_card|Loading kernel and rootfs via eMMC/SD card]].
#: {{Note}}上記の例はイメージが"weston"のため、'''"minimal"'''に置き換えることに注意すること
+
#: {{Note}} Please replace "core-image-weston" with "core-image-minimal".
  
== ターゲットボード Greengrass Core の起動確認 ==
+
== Confirmation of Greengrass Core activation ==
# R-Car SK の起動
+
# Turn on the target board
#: R-Car SK に uSD カードを挿入して、LANケーブルを接続する。
+
## Insert the SD card into the target board, and connect the LAN cable to it.
#: USB デバッグシリアルケーブルを PC と接続して、AC 電源を投入する。
+
## Use a microUSB cable to connect the target board, connect a power supply to it, and connect to serial console.
#: PC 側では、ターミナルソフトを起動して、シリアル接続を行う。
+
## The PC will start the terminal software and make a serial connection.
#: 電源 ON は POWER SW(SW8) を押下する。
+
## Power on.
# SD ブートを U-Boot で設定
+
##: Short-press SW8 "Power" to switch the board on.
#: SDブートの設定方法は、[[R-Car/Boards/Yocto-Gen3/v5.5.0#Configure_U-Boot_to_boot_from_SD_card|Configure U-Boot to boot from SD card]]を参照。
+
##: If the board is attached to the CCPF board, short-press SW4 "Power" instead of SW8.
# Greengrass Core の起動確認
+
# Configure U-Boot to boot from SD card
#: Greengrass Core が Active となっていることを確認する。
+
#: Refer to the [[R-Car/Boards/Yocto-Gen3/v5.5.0#Configure_U-Boot_to_boot_from_SD_card|Configure U-Boot to boot from SD card]].
 +
# Check that the Greengrass Core is running.
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ systemctl status greengrass.service --no-pager
 
$ systemctl status greengrass.service --no-pager
Line 238: Line 260:
 
#:: [[File:Aws-status.png||500px]]<br>
 
#:: [[File:Aws-status.png||500px]]<br>
  
== AWS IoT Greengrass の設定/動作確認 ==
+
== Configure and check AWS IoT Greengrass ==
以降の章では、以下のようなルールでタイトルにタグを記載する。
+
In subsequent chapters, the tags will be included in the title as follows.
* ターゲットボード(R-Car SK)での作業は、<端末>と記載する。
+
* Work on the target board (R-Car SK) is described as <Terminal>.
* AWS クラウドの作業は、<Web>と記載する。
+
* Work on the AWS Cloud is described as <Web>.
* ビルドPCでの作業は、<ビルドPC>と記載する。
+
* Work on the host PC is described as <PC>.
# <Web> AWSアカウントを作成
+
# <Web> Create an AWS account
 
#: https://console.aws.amazon.com/console/home
 
#: https://console.aws.amazon.com/console/home
#: AWS のアカウントを作成して、AWS マネジメントコンソールにルートユーザでログインする。
+
#: Create an AWS account and log in to the AWS Management Console as the root user.
# <Web> IAM ユーザの作成
+
# <Web> Creating an IAM user
#: 下記を参考に作業用のIAM ユーザを作成する。
+
#: Create an IAM user for work with reference to the following.
 
#: https://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/id_users_create.html#id_users_create_console
 
#: https://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/id_users_create.html#id_users_create_console
#: 作成時に以下のポリシーをアタッチしておくこと。
+
#: The following policies should be attached at the time of creation.
 
#:* AWSLambda_FullAccess
 
#:* AWSLambda_FullAccess
 
#:* IAMFullAccess
 
#:* IAMFullAccess
Line 255: Line 277:
 
#:* AWSGreengrassFullAccess
 
#:* AWSGreengrassFullAccess
 
#:* IAMAccessAnalyzerFullAccess
 
#:* IAMAccessAnalyzerFullAccess
#: {{Note}}ユーザアクセス時に表示される、「アクセスキーID」、「シークレットアクセスキー」、「パスワード」を必ずメモすること。なお、シークレットアクセスキーとパスワードは、このタイミングでしか確認できないため、注意すること。
+
#: {{Note}}Be sure to write down the "Access Key ID", "Secret Access Key", and "Password" that are displayed when users access the system. Note that the secret access key and password can only be confirmed at this time.
#: {{Warning}} '''これら3点は、セキュリティ上、非常に重要な情報であるため、管理に十分注意すること。'''
+
#: {{Warning}} '''These three items are very important information for security reasons, and should be managed with great care.'''
#: AWS のルートユーザをサインアウトして、作成した IAM ユーザでログインする。
+
#: Sign out the AWS root user and log in with the IAM user you created.
 
#: https://console.aws.amazon.com/console/home
 
#: https://console.aws.amazon.com/console/home
# <Web> リージョンの設定
+
# <Web> Setting up a region
#: 画面右上から「アジアパシフィック (東京) ap-northeast-1」を設定する。
+
#: Set the desired region from the upper right corner of the screen.
#: [[File:Aws-region.png|700px]]<br>
+
#: In this procedure, we will set "Asia Pacific(Tokyo) ap-northeast-1".
# <Web><端末> IoT Core デバイスの作成
+
# <Web><Terminal> Creating an IoT Core device
#: 事前に「ターゲットボード Greengrass Core の起動確認」を行い、端末はLANケーブルを接続してインターネットに接続できることを確認しておくこと。
+
#: Run "[[#Confirmation_of_Greengrass_Core_activation|Confirmation of Greengrass Core activation]]" beforehand and make sure that the terminal can connect to the Internet by connecting a LAN cable.
## <Web> AWS のサービスから「IoT Core」を選択する。
+
## <Web> Select "IoT Core" from AWS services.
 
##: [[File:Aws-iot-core.png|700px]]<br>
 
##: [[File:Aws-iot-core.png|700px]]<br>
## <Web> 左側面の領域から「Greengrass」→「使用を開始する」を選択する。
+
## <Web> Select "Greengrass" → "Getting started" from the side menu.
## <Web> 「1つの Core デバイスをセットアップ」を押下する。
+
## <Web> Press "Set up one core device".
## <Web><端末> 画面の指示に従い以下の作業を実施する。
+
## <Web><Terminal> Follow the instructions on the screen to perform the following tasks.
### <Web> 「ステップ 1: Greengrass コアデバイスを登録する」
+
### <Web> "Step 1: Register a Greengrass core device"
###: 任意の名称を入力する。
+
###: Enter a core device name of your choice.
###: 本手順では、コアデバイス名を "R-CarH3SKDevice" とする。
+
###: In this procedure, the core device name shall be "R-CarH3SKDevice".
### <Web> 「ステップ 2: モノのグループに追加して継続的なデプロイを適用する」
+
### <Web> "Step 2: Add to a thing group to apply a continuous deployment"
###: 「新しいグループ名を入力」をチェックして、任意の名称を入力する。
+
###: Check "Enter a new group name" and enter a name of your choice.
###: 本手順では、モノのグループ名を "R-CarH3SKDeviceGroup"とする。
+
###: In this procedure, the thing group name shall be "R-CarH3SKDeviceGroup".
### <端末> 「ステップ 3: Greengrass コアソフトウェアをインストール」
+
### <Terminal> "Step 3: Install the Greengrass Core software"
#### 「ステップ 3.1: Java をデバイスにインストールする」
+
#### "Step 3.1: Install Java on the device"
####: R-Car SK のビルドで生成したイメージに含まれているため、作業不要。
+
####: No work required as it is included in the image generated by the R-Car SK build.
#### 「ステップ 3.2: デバイスで AWS 認証情報を設定する」
+
#### "Step 3.2: Configure AWS credentials on the device"
####: 以下のコマンドを実行し、 AWS へアクセスする情報を環境変数として設定する。
+
####: Execute the following command to set the information to access AWS as an environment variable.
 
####: <syntaxhighlight lang="bash">
 
####: <syntaxhighlight lang="bash">
 
$ export AWS_DEFAULT_REGION=ap-northeast-1
 
$ export AWS_DEFAULT_REGION=ap-northeast-1
$ export AWS_ACCESS_KEY_ID=<アクセスキーID>
+
$ export AWS_ACCESS_KEY_ID=<your "Access Key ID">
$ export AWS_SECRET_ACCESS_KEY=<シークレットアクセスキー>
+
$ export AWS_SECRET_ACCESS_KEY=<your "Secret Access Key">
 
</syntaxhighlight>
 
</syntaxhighlight>
#### 「ステップ 3.3: インストーラを実行する」
+
#### "Step 3.3: Run the installer"
####: 「インストーラのダウンロード」は作業不要。
+
####: "Download the installer" requires no work.
####: 「インストーラの実行」は、Web ブラウザに表示されているものでは、Path が合わないため、端末にて、以下のコマンドを実行する。
+
####: "Run the installer" does not match the path displayed in the web browser, so execute the following command in the terminal.
 
####: <syntaxhighlight lang="bash">
 
####: <syntaxhighlight lang="bash">
 
$ java -Droot="/greengrass/v2" -Dlog.store=FILE -jar /greengrass/v2/alts/init/distro/lib/Greengrass.jar \
 
$ java -Droot="/greengrass/v2" -Dlog.store=FILE -jar /greengrass/v2/alts/init/distro/lib/Greengrass.jar \
Line 294: Line 316:
 
--deploy-dev-tools true
 
--deploy-dev-tools true
 
</syntaxhighlight>
 
</syntaxhighlight>
####: 「R-CarH3SKDevice」と「R-CarH3SKDeviceGroup」部分は「ステップ 1」と「ステップ 2」で設定した値に置き替えること。
+
####: Replace "R-CarH3SKDevice" and "R-CarH3SKDeviceGroup" with the values set in "Step 1" and "Step 2".
####: 上記コマンドを実行すると、R-Car SK 端末が AWS IoT と通信して Greengrass コアデバイスとして登録される。
+
####: When the above command is executed, the R-Car SK terminal communicates with AWS IoT and is registered as a Greengrass core device.
####: コマンドが終了して、しばらくすると Greengrass CLI が端末へデプロイされるため、以下のコマンドが実行できるか確認する。
+
####: After the command finishes, Greengrass CLI will be deployed to the terminal, and check if the following commands can be executed.
 
####: <syntaxhighlight lang="bash">
 
####: <syntaxhighlight lang="bash">
 
$ /greengrass/v2/bin/greengrass-cli -V
 
$ /greengrass/v2/bin/greengrass-cli -V
 
</syntaxhighlight>
 
</syntaxhighlight>
####: {{Note}}デプロイの状況は、以下のログで確認できる。
+
####: {{Note}}You can check the deployment status in the following log.
 
####: <syntaxhighlight lang="bash">
 
####: <syntaxhighlight lang="bash">
 
$ tail -f /greengrass/v2/logs/greengrass.log
 
$ tail -f /greengrass/v2/logs/greengrass.log
 
</syntaxhighlight>
 
</syntaxhighlight>
# <Web> IoT Core に送信するポリシーを追加
+
# <Web> Add policies to be sent to IoT Core
#: 端末で動作する Lambda 関数が AWS クラウドの IoT Core に対して メッセージを Publish するためにポリシーを追加する。
+
#: {{Note}} The examples in this document are intended only for dev environments.
## AWS のサービスから「IAM」を選択する。
+
#:     All devices in your production fleet must have credentials with privileges that authorize only intended actions on specific resources.
## サイドメニューから「ポリシー」を選択する。
+
#:     The specific permission policies can vary for your use case. Identify the permission policies that best meet your business and security requirements.
## 「ポリシーを作成」を選択する。
+
#:     For more information, refer to [https://docs.aws.amazon.com/iot/latest/developerguide/example-iot-policies.html Example policies] and [https://docs.aws.amazon.com/iot/latest/developerguide/security-best-practices.html Security Best practices].
## サービスに「IoT」を選択、アクションに「Publish」を選択、リソースに「すべてのリソース」を選択する。
+
#: Add a policy for the Lambda function running on the terminal to send messages to the IoT Core in the AWS cloud.
 +
## Select "IAM" from AWS services.
 +
## Select "Policies" from the side menu.
 +
## Select "Create Policy".
 +
## Select "IoT" for Service, "Publish" for Actions, and "All Resources" for Resources.
 
##: [[File:Aws-iot-core-policy.png|700px]]<br>
 
##: [[File:Aws-iot-core-policy.png|700px]]<br>
## 「次のステップ:タグ」、「次のステップ:確認」を押下していき、ポリシーの確認で任意の「名前」を入力し、「ポリシーの作成」ボタンを押下する。
+
## Click on "Next: Tags" and "Next: Review", then enter any "Name" in the "Review policy", and click on the "Create Policy" button.
##: 本手順では、名前を「R-CarH3SKDevice-IoT-Publish」とする。
+
##: In this procedure, the name shall be "R-CarH3SKDevice-IoT-Publish".
## IAM の画面に戻るので、サイドメニューから「ロール」を選択する。
+
## Return to the IAM screen and select "Roles" from the side menu.
## 検索に「GreengrassV2TokenExchangeRole」を入力して、同名のロールを選択する。
+
## Enter "GreengrassV2TokenExchangeRole" in the search and select the role with the same name.
## 「ポリシーをアタッチします」を押下して、先ほど作成したポリシーを検索して「ポリシーのアタッチ」を押下する。
+
## Click "Attach Policies", search for the policy you just created, and click "Attach Policy".
# <端末> Lambda 関数の実行環境準備
+
# <Terminal> Preparing the execution environment for Lambda functions
#: 端末でサンプルプログラムを動作させるための環境構築を行う。
+
#: Build an environment to run the sample program on a terminal.
#: 以下のコマンドを実行する。
+
#: Execute the following commands.
 
#: <syntaxhighlight lang="bash">
 
#: <syntaxhighlight lang="bash">
 
$ mkdir -p /home/ggc_user
 
$ mkdir -p /home/ggc_user
Line 324: Line 350:
 
$ pip3 install numpy
 
$ pip3 install numpy
 
</syntaxhighlight>
 
</syntaxhighlight>
# <Web><ビルドPC> Lambda 関数の作成
+
# <Web><PC> Creating a Lambda Function
#: 端末へデプロイする Lambda 関数を作成する。
+
#: Create a Lambda function to deploy to the terminal.
## <ビルドPC> 以下のコマンドを実行して、Lambda 関数のひな形を作成する。
+
## <PC> Run the following command to create a template for a Lambda function.
 
##: <syntaxhighlight lang="bash">
 
##: <syntaxhighlight lang="bash">
 
$ mkdir -p ~/lambda && touch ~/lambda/lambda_function.py
 
$ mkdir -p ~/lambda && touch ~/lambda/lambda_function.py
 
</syntaxhighlight>
 
</syntaxhighlight>
## <ビルドPC> 作成した lambda_function.py に以下のコードをコピペする。
+
## <PC> Copy and paste the following code into the lambda_function.py that you created.
 
##: <syntaxhighlight lang="bash">
 
##: <syntaxhighlight lang="bash">
 
import datetime
 
import datetime
Line 371: Line 397:
 
         )
 
         )
 
</syntaxhighlight>
 
</syntaxhighlight>
##: {{Note}}上記コードの以下の部分は、自身のエンドポイントに置き替える必要がある。
+
##: {{Note}}The following part of the above code needs to be replaced with its own endpoint.
 
##:       https://xxxxxxxxxxxxxxx-ats.iot.ap-northeast-1.amazonaws.com
 
##:       https://xxxxxxxxxxxxxxx-ats.iot.ap-northeast-1.amazonaws.com
##: エンドポイントは、以下から確認できる。
+
##: The endpoints can be found below.
### <Web> AWS のサービスから「IoT Core」を選択する。
+
### <Web> Select "IoT Core" from AWS services.
### <Web> サイドメニューから「設定」を選択する。
+
### <Web> Select "Settings" from the side menu.
### <Web> デバイスデータエンドポイントの「エンドポイント」を参照する。
+
### <Web> Refer to "Endpoint" in Device data endpoint.
## <ビルドPC> パッケージの zip 化
+
## <PC> Zip the packages.
##: 作成した lambda_function.py boto3 パッケージを zip 圧縮する。
+
##: Zip the lambda_function.py and boto3 packages you have created.
 
##: <syntaxhighlight lang="bash">
 
##: <syntaxhighlight lang="bash">
 
$ cd ~/lambda
 
$ cd ~/lambda
Line 385: Line 411:
 
$ zip -r lambda_artifact.zip ./
 
$ zip -r lambda_artifact.zip ./
 
</syntaxhighlight>
 
</syntaxhighlight>
##: 圧縮した zip ファイルは、クラウドへアップロードするため、AWS クラウドへアクセスしているPCにコピーする。
+
##: The zip file is copied to a PC that has access to the AWS cloud for uploading to the cloud.
# <Web> Lambda 関数の登録
+
# <Web> Registering the Lambda function
#: 作成した Lambda 関数を AWS クラウドへ登録する。
+
#: Register the created Lambda function to the AWS cloud.
## AWS のサービスから「Lambda」を選択する。
+
## Select "Lambda" from AWS services.
## サイドメニューから「関数」を選択する。
+
## Select "Functions" from the side menu.
## 「関数の作成」を選択する。
+
## Select "Create function".
 
##: [[File:Aws-lambda-function-create-1.png|1000px]]<br>
 
##: [[File:Aws-lambda-function-create-1.png|1000px]]<br>
## 「一から作成」にチェックを付ける。
+
## Check the "Author from scratch" box.
## 「関数名」に任意の名称を付ける。本手順では「DummyTemperatureSensor」とする。
+
## Give an arbitrary name to the "Function name". In this procedure, "DummyTemperatureSensor" is used.
## 「ランタイム」に Python3.8 を選択する。
+
## Select "Python 3.8" as the Runtime.
## 「アーキテクチャ」に arm64 を選択する。
+
## Select "arm64" as the Architecture.
## それ以外は、デフォルト値で「関数の作成」を押下する。
+
## Other items keep the default values and press "Create Function".
## 画面が切り替わったら「コードソース」の右側から、「アップロード元」→「.zip ファイル」を選択し、作成した zip ファイルをアップロード→保存する。
+
## When the screen changes, from the right side of "Code source", select "Upload from" → ".zip file", and upload → save the zip file you created.
## 右上の「アクション」→「新しいバーションを発行」を選択し、発行を押下する。
+
## Select "Actions" → "Publish new version" in the upper right corner and press Publish.
# <Web> Lambda 関数のデプロイ
+
# <Web> Deploying the Lambda function
#: 登録した Lambda 関数を端末へデプロイする。
+
#: Deploy the registered Lambda function to the terminal.
## AWS のサービスから「IoT Core」を選択する。
+
## Select "IoT Core" from AWS services.
## サイドメニューから「Greengrass」→「コンポーネント」を選択する。
+
## Select "Greengrass" → "Components" from the side menu.
## 「コンポーネントを作成」を押下する。
+
## Click on "Create component".
 
##: [[File:Aws-lambda-function-deploy-1.png|700px]]<br>
 
##: [[File:Aws-lambda-function-deploy-1.png|700px]]<br>
## 「Lambda 関数をインポートする」にチェックを入れる。
+
## Check the "Import Lambda function" box.
## 「Lambda 関数」に作成した、関数を選択する。
+
## Select the function that you created in "Lambda function".
## イベントソースの「トピック」に「topic/sensor/get」を入力する。
 
## イベントソースの「タイプ」に「AWS IoT Core MQTT」を選択する。
 
## コンテナパラメータの「メモリサイズ」を「64」MB とする。
 
## それ以外は、デフォルト値のまま「コンポーネントを作成」を押下する。
 
 
##: [[File:Aws-lambda-function-deploy-2.png|700px]]<br>
 
##: [[File:Aws-lambda-function-deploy-2.png|700px]]<br>
 +
## Enter "topic/sensor/get" in the "Topic" field of the Event sources.
 +
## Select "AWS IoT Core MQTT" as the "Type" of the Event sources.
 
##: [[File:Aws-lambda-function-deploy-3.png|700px]]<br>
 
##: [[File:Aws-lambda-function-deploy-3.png|700px]]<br>
 +
## Set the "Memory size" of Container parameters to "64 MB".
 
##: [[File:Aws-lambda-function-deploy-4.png|700px]]<br>
 
##: [[File:Aws-lambda-function-deploy-4.png|700px]]<br>
## 画面が切り替わったら、右上の「デプロイ」を押下する。
+
## Other items keep the default values and press "Create component".
## デプロイ先に作成したグループを選択して「次へ」を押下する。
+
## When the screen changes, press "Deploy" in the upper right corner.
## あとは、デフォルト値のまま「次へ」を押下していき、最後の確認画面でデプロイを押下する。
+
## Select the group you created for the deployment destination and click "Next".
# <WEB> <端末> 動作確認
+
## Other items keep the default values and press  "Next" several times, and press "Deploy" at the last confirmation screen.
#: 端末側に作成した関数がデプロイされることを確認する。
+
# <WEB> <Terminal> Operation check
#: また、端末側のログを確認して、AWS IoT → 端末へメッセージが受信できているかを確認する。
+
#: Confirm that the function you created will be deployed on the terminal side.
## <端末> R-Car SK の動作確認
+
#: Also, check the log on the terminal side to see if messages are being received by AWS IoT → terminal.
### Lambda 関数がデプロイされているか確認する。
+
## <Terminal> Checking the operation of R-Car SK
###: 以下のコマンドを実行して確認する。
+
### Confirm that the Lambda function has been deployed.
 +
###: Execute the following command to confirm.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
$ /greengrass/v2/bin/greengrass-cli component list
 
$ /greengrass/v2/bin/greengrass-cli component list
 
</syntaxhighlight>
 
</syntaxhighlight>
###: 実行すると以下のようなログが出力され、デプロイした関数(DummyTemperatureSensor)が、リストに表示されたことが確認できる。
+
###: When you execute the command the following log will be output, and you can see that the deployed function (DummyTemperatureSensor) is displayed in the list.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
root@m3ulcb:~# /greengrass/v2/bin/greengrass-cli component list
 
root@m3ulcb:~# /greengrass/v2/bin/greengrass-cli component list
AWS libcrypto resolve: searching process and loaded modules
 
AWS libcrypto resolve: found static aws-lc HMAC symbols
 
AWS libcrypto resolve: found static aws-lc libcrypto 1.1.1 EVP_MD symbols
 
Dec 03, 2021 12:19:11 PM software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection$1 onConnectionSetup
 
INFO: Socket connection /greengrass/v2/ipc.socket:8033 to server result [AWS_ERROR_SUCCESS]
 
Dec 03, 2021 12:19:11 PM software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection$1 onProtocolMessage
 
INFO: Connection established with event stream RPC server
 
Components currently running in Greengrass:
 
Component Name: UpdateSystemPolicyService
 
    Version: 0.0.0
 
    State: RUNNING
 
    Configuration: null
 
Component Name: aws.greengrass.Nucleus
 
    Version: 2.4.0
 
    State: FINISHED
 
    Configuration: {"awsRegion":"ap-northeast-1","componentStoreMaxSizeBytes":"10000000000","deploymentPollingFrequencySeconds":"15","envStage":"prod","fleetStatus":{"periodicStatusPublishIntervalSeconds":86400.0},"greengrassDataPlanePort":"8443","iotCredEndpoint":"cdadv9za3e7xo.credentials.iot.ap-northeast-1.amazonaws.com","iotDataEndpoint":"a2l7mi87oso3zh-ats.iot.ap-northeast-1.amazonaws.com","iotRoleAlias":"GreengrassV2TokenExchangeRoleAlias","jvmOptions":"-Dlog.store=FILE","logging":{},"mqtt":{"spooler":{}},"networkProxy":{"proxy":{}},"platformOverride":{},"runWithDefault":{"posixShell":"sh","posixUser":"ggc_user:ggc_group"},"telemetry":{}}
 
Component Name: DeploymentService
 
    Version: 0.0.0
 
    State: RUNNING
 
    Configuration: null
 
 
 
     :
 
     :
 
     :
 
     :
  
Component Name: DummyTemperatureSensor                 ← ★
+
Component Name: DummyTemperatureSensor
     Version: 9.0.0
+
     Version: 1.0.0
 
     State: RUNNING
 
     State: RUNNING
 
     Configuration: {"containerMode":"GreengrassContainer","containerParams":{"devices":{},"memorySize":64000.0,"mountROSysfs":false,"volumes":{}},"inputPayloadEncodingType":"json","lambdaExecutionParameters":{"EnvironmentVariables":{}},"maxIdleTimeInSeconds":60.0,"maxInstancesCount":100.0,"maxQueueSize":1000.0,"pinned":true,"pubsubTopics":{"0":{"topic":"topic/sensor/get","type":"IOT_CORE"}},"statusTimeoutInSeconds":60.0,"timeoutInSeconds":3.0}
 
     Configuration: {"containerMode":"GreengrassContainer","containerParams":{"devices":{},"memorySize":64000.0,"mountROSysfs":false,"volumes":{}},"inputPayloadEncodingType":"json","lambdaExecutionParameters":{"EnvironmentVariables":{}},"maxIdleTimeInSeconds":60.0,"maxInstancesCount":100.0,"maxQueueSize":1000.0,"pinned":true,"pubsubTopics":{"0":{"topic":"topic/sensor/get","type":"IOT_CORE"}},"statusTimeoutInSeconds":60.0,"timeoutInSeconds":3.0}
 
</syntaxhighlight>
 
</syntaxhighlight>
### ログを確認する。
+
### Check the log.
###: 以下のコマンドを実行してログを確認する。
+
###: Run the following command to check the log.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
$ cd /greengrass/v2/logs/
 
$ cd /greengrass/v2/logs/
$ tail -f <作成した関数名>.log
+
$ tail -f <name of created function>.log
 
</syntaxhighlight>
 
</syntaxhighlight>
###: 実行すると以下のようなログが出力される。
+
###: Verify that the following log is output.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
root@m3ulcb:/greengrass/v2/logs# tail -f DummyTemperatureSensor.log
+
serviceName=<name of created function>, currentState=RUNNING
2021-12-08T06:34:42.768Z [INFO] (pool-2-thread-29) DummyTemperatureSensor: shell-runner-start. {scriptName=services.DummyTemperatureSensor.lifecycle.startup.script, serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=STARTING, command=["/greengrass/v2/packages/artifacts/aws.greengrass.LambdaLauncher/2.0.9/lambda-l..."]}
 
2021-12-08T06:34:42.871Z [INFO] (pool-2-thread-33) DummyTemperatureSensor: Setting up overlay tmpfs mounts. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=STARTING}
 
2021-12-08T06:34:43.742Z [INFO] (pool-2-thread-33) DummyTemperatureSensor: Finding mounted cgroups.. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=STARTING}
 
2021-12-08T06:34:43.958Z [INFO] (Copier) DummyTemperatureSensor: stdout. Started process: 992. {scriptName=services.DummyTemperatureSensor.lifecycle.startup.script, serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=STARTING}
 
2021-12-08T06:34:43.974Z [INFO] (Copier) DummyTemperatureSensor: Startup script exited. {exitCode=0, serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=STARTING}
 
2021-12-08T06:34:44.543Z [INFO] (pool-2-thread-33) DummyTemperatureSensor: lambda_runtime.py:402,Status thread started. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING}
 
2021-12-08T06:34:47.149Z [INFO] (pool-2-thread-33) DummyTemperatureSensor: lambda_runtime.py:154,Running [arn:aws:lambda:ap-northeast-1:057956790067:function:DummyTemperatureSensor:9]. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING}
 
 
</syntaxhighlight>
 
</syntaxhighlight>
## <Web><端末> AWS クラウドの動作確認
+
## <Web><Terminal> Checking the operation of the AWS cloud
### <Web> AWS のサービスから「IoT Core」を選択する。
+
### <Web> Select "IoT Core" from AWS services.
### <Web> サイドメニューから「テスト」→「MQTT テストクライアント」を選択する。
+
### <Web> Select "Test" → "MQTT Test Client" from the side menu.
### <Web> 「トピックをサブスクライブする」で「topic/sensor/temperature」を入力して「サブスクライブ」を押下する。
+
### <Web> Enter "topic/sensor/temperature" in the Topic filter and press "SUBSCRIBE".
### <Web> 「トピックに公開する」で「topic/sensor/get」を入力して「発行」を押下する。
+
### <Web> Enter "topic/sensor/get" in the "Topic name" of "Publish to a topic" and click "Publish.
###: {{Note}}デフォルトのメッセージペイロードだと、端末側で文字化けするため、必要に応じて任意の英数字の文章へ変更すること。
+
###: {{Note}}The default message payload will be garbled on the terminal side, so change it to any alphanumeric text if necessary.
### <端末> 以下のようにログにメッセージ受信内容が表示される。
+
### <Terminal> The message received will be displayed in the log as follows.
 
###: <syntaxhighlight lang="bash">
 
###: <syntaxhighlight lang="bash">
 
root@m3ulcb:/greengrass/v2/logs# tail -f DummyTemperatureSensor.log
 
root@m3ulcb:/greengrass/v2/logs# tail -f DummyTemperatureSensor.log
Line 489: Line 487:
 
2021-12-06T04:51:14.969Z [INFO] (pool-2-thread-38) DummyTemperatureSensor: lambda_function.py:31,{'timestamp': '2021-12-06 04:51:14.964931', 'temperature': 25.003559249938885}. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING
 
2021-12-06T04:51:14.969Z [INFO] (pool-2-thread-38) DummyTemperatureSensor: lambda_function.py:31,{'timestamp': '2021-12-06 04:51:14.964931', 'temperature': 25.003559249938885}. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING
 
</syntaxhighlight>
 
</syntaxhighlight>
### <Web> サブスクリプションにメッセージが受信される。
+
### <Web> A message is received in the subscription.
 
###: [[File:Aws-result1.png|1000px]]<br>
 
###: [[File:Aws-result1.png|1000px]]<br>

Latest revision as of 07:24, 20 January 2022


Introduction

This page describes how to setup the Yocto environment to use the AWS IoT Greengrass with R-Car and run it.

This page contains information abot building and running AWS IoT Greengrass on Yocto environment on:

Topic

The new version of R-Car Starter Kit Premier is now on sale !!

  • Equipped with R-Car H3e-2G
    (En) https://www.renesas.com/jp/en/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
    (Zh) https://www.renesas.com/jp/zh/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
    (Jp) https://www.renesas.com/jp/ja/about/press-room/renesas-launches-r-car-gen3e-20-percent-higher-cpu-speed-automotive-infotainment-cockpit-and-digital
  • CPU performance is increased 20% by supporting up to 2GHz frequency over past products.
  • You can buy from here.

SW Release Information

Board name SW name Release date Note
R-Car Starter Kit ( Premier / Pro ) Yocto v5.9.0 (stable) [New!!] 2022/02/08
Kingfisher Infotainment Board Yocto v5.9.0 (stable) [New!!] 2022/02/14 To check for latest information, please refer to the meta-rcar/tree/v5.9.0.
Android 10 (stable) 2021/07/26 R-Car Starter Kit Premier(R-Car H3) + Kingfisher is supported.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) + Kingfisher is also supported from 2021/11/25.
Android P (stable) 2020/09/29 R-Car Starter Kit Premier(R-Car H3) + Kingfisher is supported.
R-Car Starter Kit Pro(RTP8J77961ASKB0SK0SA05A) + Kingfisher is also supported from 2021/03/16.
CCPF-SK Board Yocto v5.9.0 (latest) [New!!] 2022/02/08 Prebuilt binary is available in Quick startup guide page. (Updated on 2022/03/18)


Software revisions

Software Revision
Yocto Project 3.1.8
aarch64-poky-linux-gcc (GCC) 9.3
Kernel Ver 5.10.41
Userland 64/32bit 64
U-Boot 2020.10
OP_TEE 3.13.0
Greengrass 2.4.0

Environment

Host PC

OS Ubuntu 20.04 LTS (64bit)
Memory 8 GB or more
Storage At least 100 GB free

Boards confirmed to work

Board SoC Confirmed
R-Car Starter Kit Premier(H3) H3e-2G v3.0 OK
R-Car Starter Kit Premier(H3) H3 v3.0 (1rank DDR) OK
R-Car Starter Kit Premier(H3) H3 v3.0 (2rank DDR) NT
R-Car Starter Kit Premier(H3) H3 v2.0 with 4GB DDR OK
R-Car Starter Kit Pro M3 v3.0 OK
R-Car Starter Kit Pro M3 v1.0 OK
CCPF-SK + R-Car Starter Kit Premier(H3) H3e-2G v3.0 OK
CCPF-SK + R-Car Starter Kit Premier(H3) H3 v3.0 (1rank DDR) OK
CCPF-SK + R-Car Starter Kit Premier(H3) H3 v3.0 (2rank DDR) NT
CCPF-SK + R-Car Starter Kit Premier(H3) H3 v2.0 with 4GB DDR OK
CCPF-SK + R-Car Starter Kit Pro M3 v3.0 OK
CCPF-SK + R-Car Starter Kit Pro M3 v1.0 OK

18px <translate> Note:</translate> NT='Not Tested' but will work

See also:

Required packages

  1. Install required packages
    $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
    build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
    xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa \
    libsdl1.2-dev pylint3 xterm docker.io
    
    Refer to Yocto Project Quick Start for more information.
    18px <translate> Note:</translate>If the OS version of the host PC is earlier than "Ubuntu 20.04", the default gcc version is old, so use "gcc-9/g++-9" or later version.
  1. Set up initial git configuration
    $ git config --global user.email "you@example.com"
    $ git config --global user.name "Your Name"
    

Building the BSP

  1. Create the following script(build.sh) for building
    #!/bin/bash
    
    BOARD_LIST=("h3ulcb" "m3ulcb" "h3ulcb-ccpf-sk" "m3ulcb-ccpf-sk")
    TARGET_BOARD=$1
    WORK=`pwd`/${TARGET_BOARD}
    
    # Commit ID
    POKY_COMMIT=6ebb33bdaccaeadff0c85aab27acf35723df00d8
    META_OE_COMMIT=c38d2a74f762a792046f3d3c377827b08aade513
    META_RENESAS_COMMIT=0fe77668f5d9a31a5d10449988c3d8fb8dc475c5
    META_RENESAS_CCPF_COMMIT=b49b57d6e68d5cda70aefbed34e06903484c573b
    META_VIRTUALIZATION_COMMIT=c4f156fa93b37b2428e09ae22dbd7f5875606f4d
    META_JAVA_COMMIT=62d6c0653ad69e14c21db2d4482e578400116a1b
    META_AWS_COMMIT=09a9e8845e1c0685d279a5fec12dc2764e67675c
    META_DOCKER_COMMIT=1ca1b5caf6f373dcc49db82dce50f4d8ab9f25cd
    
    Usage () {
        echo "Usage: $0 \${TARGET_BOARD_NAME}"
        echo "BOARD_NAME list: "
        for i in ${BOARD_LIST[@]}; do echo "  - $i"; done
        exit
    }
    
    # Check Param.
    if ! `IFS=$'\n'; echo "${BOARD_LIST[*]}" | grep -qx "${TARGET_BOARD}"`; then
        Usage
    fi
    
    mkdir -p ${WORK}
    cd ${WORK}
    
    # Clone basic Yocto layers in parallel
    git clone git://git.yoctoproject.org/poky &
    git clone git://git.openembedded.org/meta-openembedded &
    git clone git://github.com/renesas-rcar/meta-renesas &
    git clone git://git.yoctoproject.org/meta-virtualization &
    git clone git://git.yoctoproject.org/meta-java &
    git clone git://github.com/aws/meta-aws &
    git clone git://github.com/tkomagata/meta-docker &
    if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
        git clone git://github.com/renesas-rcar/meta-renesas-ccpf &
    fi
    
    # Wait for all clone operations
    wait
    
    # Switch to proper branches/commits
    cd ${WORK}/poky
    git checkout -b tmp ${POKY_COMMIT}
    cd ${WORK}/meta-openembedded
    git checkout -b tmp ${META_OE_COMMIT}
    cd ${WORK}/meta-renesas
    git checkout -b tmp ${META_RENESAS_COMMIT}
    cd ${WORK}/meta-virtualization
    git checkout -b tmp ${META_VIRTUALIZATION_COMMIT}
    cd ${WORK}/meta-java
    git checkout -b tmp ${META_JAVA_COMMIT}
    cd ${WORK}/meta-aws
    git checkout -b tmp ${META_AWS_COMMIT}
    cd ${WORK}/meta-docker
    git checkout -b tmp ${META_DOCKER_COMMIT}
    if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
        cd ${WORK}/meta-renesas-ccpf
        git checkout -b tmp ${META_RENESAS_CCPF_COMMIT}
    fi
    
    if [ "${TARGET_BOARD}" = "h3ulcb-ccpf-sk" ] || [ "${TARGET_BOARD}" = "m3ulcb-ccpf-sk" ]; then
        TEMPLATECONF=${WORK}/meta-renesas-ccpf/meta-rcar-gen3/docs/sample/conf/${TARGET_BOARD}/bsp/
    fi
    
    cd ${WORK}
    source poky/oe-init-build-env ${WORK}/build
    
    if [ "${TARGET_BOARD}" = "h3ulcb" ] || [ "${TARGET_BOARD}" = "m3ulcb" ]; then
        cp ${WORK}/meta-renesas/meta-rcar-gen3/docs/sample/conf/${TARGET_BOARD}/poky-gcc/bsp/bblayers.conf ${WORK}/build/conf/
        cp ${WORK}/meta-renesas/meta-rcar-gen3/docs/sample/conf/${TARGET_BOARD}/poky-gcc/bsp/local.conf ${WORK}/build/conf/
    fi
    
    bitbake-layers add-layer ../meta-openembedded/meta-networking
    bitbake-layers add-layer ../meta-openembedded/meta-filesystems
    bitbake-layers add-layer ../meta-virtualization
    bitbake-layers add-layer ../meta-docker/meta-rcar-gen3
    bitbake-layers add-layer ../meta-java
    bitbake-layers add-layer ../meta-aws
    
  2. Using setup script
    $ chmod a+x setup.sh
    $ ./setup.sh <target_board_name>
    
    target_board_name is specified for each board according to the following table:
    R-car-sk-target-board-name.png
  3. Append the following to local configuration(<target_board_name>/build/conf/local.conf)
    # Docker presumes systemd
    DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
    VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
    
    # add docker to the image
    DISTRO_FEATURES_append = " virtualization docker"
    IMAGE_INSTALL_append = "  docker"
    CORE_IMAGE_EXTRA_INSTALL_append = " kernel-modules"
    
    # Add Greengrass and required packages to the image
    IMAGE_INSTALL_append = " greengrass-bin texinfo sudo openjdk-8"
    EXTRA_IMAGE_FEATURES_append = " ssh-server-openssh"
    
    # Possible provider: cacao-initial-native and jamvm-initial-native
    PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native"
    
    # Possible provider: cacao-native and jamvm-native
    PREFERRED_PROVIDER_virtual/java-native = "jamvm-native"
    
    # Optional since there is only one provider for now
    PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
    
    IMAGE_INSTALL_append = " python3-pip"
    
  4. Build
    $ cd <target_board_name>
    $ source poky/oe-init-build-env
    $ bitbake core-image-minimal
    
    Depending on the performance of the host PC, it may take several hours for the build to complete.
    When the build completes successfully, you will see the following output:
    NOTE: Tasks Summary: Attempted 5383 tasks of which 5 didn't need to be rerun and all succeeded.
    
  5. Check the built images
    The built images are stored in the following:
     <target_board_name>/build/tmp/deploy/images/<target_board_name>/
  6. Write the images to the SD card
    Write the images to the SD card with reference to Loading kernel and rootfs via eMMC/SD card.
    18px <translate> Note:</translate> Please replace "core-image-weston" with "core-image-minimal".

Confirmation of Greengrass Core activation

  1. Turn on the target board
    1. Insert the SD card into the target board, and connect the LAN cable to it.
    2. Use a microUSB cable to connect the target board, connect a power supply to it, and connect to serial console.
    3. The PC will start the terminal software and make a serial connection.
    4. Power on.
      Short-press SW8 "Power" to switch the board on.
      If the board is attached to the CCPF board, short-press SW4 "Power" instead of SW8.
  2. Configure U-Boot to boot from SD card
    Refer to the Configure U-Boot to boot from SD card.
  3. Check that the Greengrass Core is running.
    $ systemctl status greengrass.service --no-pager
    
    Aws-status.png

Configure and check AWS IoT Greengrass

In subsequent chapters, the tags will be included in the title as follows.

  • Work on the target board (R-Car SK) is described as <Terminal>.
  • Work on the AWS Cloud is described as <Web>.
  • Work on the host PC is described as <PC>.
  1. <Web> Create an AWS account
    https://console.aws.amazon.com/console/home
    Create an AWS account and log in to the AWS Management Console as the root user.
  2. <Web> Creating an IAM user
    Create an IAM user for work with reference to the following.
    https://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/id_users_create.html#id_users_create_console
    The following policies should be attached at the time of creation.
    • AWSLambda_FullAccess
    • IAMFullAccess
    • AWSIoTFullAccess
    • AWSGreengrassFullAccess
    • IAMAccessAnalyzerFullAccess
    18px <translate> Note:</translate>Be sure to write down the "Access Key ID", "Secret Access Key", and "Password" that are displayed when users access the system. Note that the secret access key and password can only be confirmed at this time.
    Warning Warning: These three items are very important information for security reasons, and should be managed with great care.
    Sign out the AWS root user and log in with the IAM user you created.
    https://console.aws.amazon.com/console/home
  3. <Web> Setting up a region
    Set the desired region from the upper right corner of the screen.
    In this procedure, we will set "Asia Pacific(Tokyo) ap-northeast-1".
  4. <Web><Terminal> Creating an IoT Core device
    Run "Confirmation of Greengrass Core activation" beforehand and make sure that the terminal can connect to the Internet by connecting a LAN cable.
    1. <Web> Select "IoT Core" from AWS services.
      Aws-iot-core.png
    2. <Web> Select "Greengrass" → "Getting started" from the side menu.
    3. <Web> Press "Set up one core device".
    4. <Web><Terminal> Follow the instructions on the screen to perform the following tasks.
      1. <Web> "Step 1: Register a Greengrass core device"
        Enter a core device name of your choice.
        In this procedure, the core device name shall be "R-CarH3SKDevice".
      2. <Web> "Step 2: Add to a thing group to apply a continuous deployment"
        Check "Enter a new group name" and enter a name of your choice.
        In this procedure, the thing group name shall be "R-CarH3SKDeviceGroup".
      3. <Terminal> "Step 3: Install the Greengrass Core software"
        1. "Step 3.1: Install Java on the device"
          No work required as it is included in the image generated by the R-Car SK build.
        2. "Step 3.2: Configure AWS credentials on the device"
          Execute the following command to set the information to access AWS as an environment variable.
          $ export AWS_DEFAULT_REGION=ap-northeast-1
          $ export AWS_ACCESS_KEY_ID=<your "Access Key ID">
          $ export AWS_SECRET_ACCESS_KEY=<your "Secret Access Key">
          
        3. "Step 3.3: Run the installer"
          "Download the installer" requires no work.
          "Run the installer" does not match the path displayed in the web browser, so execute the following command in the terminal.
          $ java -Droot="/greengrass/v2" -Dlog.store=FILE -jar /greengrass/v2/alts/init/distro/lib/Greengrass.jar \
          --aws-region ap-northeast-1 --thing-name R-CarH3SKDevice --thing-group-name R-CarH3SKDeviceGroup \
          --component-default-user ggc_user:ggc_group --provision true --setup-system-service true \
          --deploy-dev-tools true
          
          Replace "R-CarH3SKDevice" and "R-CarH3SKDeviceGroup" with the values set in "Step 1" and "Step 2".
          When the above command is executed, the R-Car SK terminal communicates with AWS IoT and is registered as a Greengrass core device.
          After the command finishes, Greengrass CLI will be deployed to the terminal, and check if the following commands can be executed.
          $ /greengrass/v2/bin/greengrass-cli -V
          
          18px <translate> Note:</translate>You can check the deployment status in the following log.
          $ tail -f /greengrass/v2/logs/greengrass.log
          
  5. <Web> Add policies to be sent to IoT Core
    18px <translate> Note:</translate> The examples in this document are intended only for dev environments.
        All devices in your production fleet must have credentials with privileges that authorize only intended actions on specific resources.
        The specific permission policies can vary for your use case. Identify the permission policies that best meet your business and security requirements.
        For more information, refer to Example policies and Security Best practices.
    Add a policy for the Lambda function running on the terminal to send messages to the IoT Core in the AWS cloud.
    1. Select "IAM" from AWS services.
    2. Select "Policies" from the side menu.
    3. Select "Create Policy".
    4. Select "IoT" for Service, "Publish" for Actions, and "All Resources" for Resources.
      Aws-iot-core-policy.png
    5. Click on "Next: Tags" and "Next: Review", then enter any "Name" in the "Review policy", and click on the "Create Policy" button.
      In this procedure, the name shall be "R-CarH3SKDevice-IoT-Publish".
    6. Return to the IAM screen and select "Roles" from the side menu.
    7. Enter "GreengrassV2TokenExchangeRole" in the search and select the role with the same name.
    8. Click "Attach Policies", search for the policy you just created, and click "Attach Policy".
  6. <Terminal> Preparing the execution environment for Lambda functions
    Build an environment to run the sample program on a terminal.
    Execute the following commands.
    $ mkdir -p /home/ggc_user
    $ chown ggc_user:ggc_group /home/ggc_user
    $ pip3 install numpy
    
  7. <Web><PC> Creating a Lambda Function
    Create a Lambda function to deploy to the terminal.
    1. <PC> Run the following command to create a template for a Lambda function.
      $ mkdir -p ~/lambda && touch ~/lambda/lambda_function.py
      
    2. <PC> Copy and paste the following code into the lambda_function.py that you created.
      import datetime
      import json
      import numpy
      import boto3
      
      class DummyTemperatureSensor(object):
          def __init__(self, loc=25, scale=1, size=1):
              self.loc = loc
              self.scale = scale
              self.size = size
      
          def get_value(self):
              return numpy.random.normal(self.loc, self.scale, self.size)[0]
      
      
      def lambda_handler(event, context):
          print(event)
      
          # AWS IoT connection
          iot = boto3.client('iot-data', endpoint_url='https://xxxxxxxxxxxxxxx-ats.iot.ap-northeast-1.amazonaws.com')
      
          # get temperature
          sensor = DummyTemperatureSensor()
      
          # set publish paramater
          topic='topic/sensor/temperature'
          payload = {
              "timestamp": str( datetime.datetime.now() ), 
              "temperature": sensor.get_value()
          }
          print(payload)
      
          # publish to AWS IoT
          iot.publish(
                  topic=topic,
                  qos=0,
                  payload=json.dumps(payload, ensure_ascii=False)
              )
      
      18px <translate> Note:</translate>The following part of the above code needs to be replaced with its own endpoint.
            https://xxxxxxxxxxxxxxx-ats.iot.ap-northeast-1.amazonaws.com
      The endpoints can be found below.
      1. <Web> Select "IoT Core" from AWS services.
      2. <Web> Select "Settings" from the side menu.
      3. <Web> Refer to "Endpoint" in Device data endpoint.
    3. <PC> Zip the packages.
      Zip the lambda_function.py and boto3 packages you have created.
      $ cd ~/lambda
      $ sudo docker run --rm -v $(pwd):/var/task amazon/aws-sam-cli-build-image-python3.8:latest \
        pip install boto3 -t ./
      $ zip -r lambda_artifact.zip ./
      
      The zip file is copied to a PC that has access to the AWS cloud for uploading to the cloud.
  8. <Web> Registering the Lambda function
    Register the created Lambda function to the AWS cloud.
    1. Select "Lambda" from AWS services.
    2. Select "Functions" from the side menu.
    3. Select "Create function".
      Aws-lambda-function-create-1.png
    4. Check the "Author from scratch" box.
    5. Give an arbitrary name to the "Function name". In this procedure, "DummyTemperatureSensor" is used.
    6. Select "Python 3.8" as the Runtime.
    7. Select "arm64" as the Architecture.
    8. Other items keep the default values and press "Create Function".
    9. When the screen changes, from the right side of "Code source", select "Upload from" → ".zip file", and upload → save the zip file you created.
    10. Select "Actions" → "Publish new version" in the upper right corner and press Publish.
  9. <Web> Deploying the Lambda function
    Deploy the registered Lambda function to the terminal.
    1. Select "IoT Core" from AWS services.
    2. Select "Greengrass" → "Components" from the side menu.
    3. Click on "Create component".
      Aws-lambda-function-deploy-1.png
    4. Check the "Import Lambda function" box.
    5. Select the function that you created in "Lambda function".
      Aws-lambda-function-deploy-2.png
    6. Enter "topic/sensor/get" in the "Topic" field of the Event sources.
    7. Select "AWS IoT Core MQTT" as the "Type" of the Event sources.
      Aws-lambda-function-deploy-3.png
    8. Set the "Memory size" of Container parameters to "64 MB".
      Aws-lambda-function-deploy-4.png
    9. Other items keep the default values and press "Create component".
    10. When the screen changes, press "Deploy" in the upper right corner.
    11. Select the group you created for the deployment destination and click "Next".
    12. Other items keep the default values and press "Next" several times, and press "Deploy" at the last confirmation screen.
  10. <WEB> <Terminal> Operation check
    Confirm that the function you created will be deployed on the terminal side.
    Also, check the log on the terminal side to see if messages are being received by AWS IoT → terminal.
    1. <Terminal> Checking the operation of R-Car SK
      1. Confirm that the Lambda function has been deployed.
        Execute the following command to confirm.
        $ /greengrass/v2/bin/greengrass-cli component list
        
        When you execute the command the following log will be output, and you can see that the deployed function (DummyTemperatureSensor) is displayed in the list.
        root@m3ulcb:~# /greengrass/v2/bin/greengrass-cli component list
            :
            :
        
        Component Name: DummyTemperatureSensor
            Version: 1.0.0
            State: RUNNING
            Configuration: {"containerMode":"GreengrassContainer","containerParams":{"devices":{},"memorySize":64000.0,"mountROSysfs":false,"volumes":{}},"inputPayloadEncodingType":"json","lambdaExecutionParameters":{"EnvironmentVariables":{}},"maxIdleTimeInSeconds":60.0,"maxInstancesCount":100.0,"maxQueueSize":1000.0,"pinned":true,"pubsubTopics":{"0":{"topic":"topic/sensor/get","type":"IOT_CORE"}},"statusTimeoutInSeconds":60.0,"timeoutInSeconds":3.0}
        
      2. Check the log.
        Run the following command to check the log.
        $ cd /greengrass/v2/logs/
        $ tail -f <name of created function>.log
        
        Verify that the following log is output.
        serviceName=<name of created function>, currentState=RUNNING
        
    2. <Web><Terminal> Checking the operation of the AWS cloud
      1. <Web> Select "IoT Core" from AWS services.
      2. <Web> Select "Test" → "MQTT Test Client" from the side menu.
      3. <Web> Enter "topic/sensor/temperature" in the Topic filter and press "SUBSCRIBE".
      4. <Web> Enter "topic/sensor/get" in the "Topic name" of "Publish to a topic" and click "Publish.
        18px <translate> Note:</translate>The default message payload will be garbled on the terminal side, so change it to any alphanumeric text if necessary.
      5. <Terminal> The message received will be displayed in the log as follows.
        root@m3ulcb:/greengrass/v2/logs# tail -f DummyTemperatureSensor.log
        2021-12-06T04:50:40.524Z [INFO] (pool-2-thread-38) DummyTemperatureSensor: lambda_function.py:17,{'message': 'AWS IoT ??????????????????????????????'}. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING}
        2021-12-06T04:50:41.172Z [INFO] (pool-2-thread-38) DummyTemperatureSensor: lambda_function.py:31,{'timestamp': '2021-12-06 04:50:41.168002', 'temperature': 27.381898093845034}. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING}
        2021-12-06T04:51:14.939Z [INFO] (pool-2-thread-38) DummyTemperatureSensor: lambda_function.py:17,{'message': 'hello world'}. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING}
        2021-12-06T04:51:14.969Z [INFO] (pool-2-thread-38) DummyTemperatureSensor: lambda_function.py:31,{'timestamp': '2021-12-06 04:51:14.964931', 'temperature': 25.003559249938885}. {serviceInstance=0, serviceName=DummyTemperatureSensor, currentState=RUNNING
        
      6. <Web> A message is received in the subscription.
        Aws-result1.png