1.- 在Cloud9上创建Edge device (cloud9也是一部虚拟机,也可用EC2代替)
Create environment
进入cloud9
安装greengrass环境
sudo yum update -y
sudo python3 -m pip install -U pip
sudo python3 -m pip install awsiotsdk
sudo yum install java
2.- 进入AWS IoT创建Core device
将下面命令复制下来
3.- cloud9安装Core device
获取credential
输入 AWS credentials
export AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID>
export AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY>
export AWS_SESSION_TOKEN=<AWS_SESSION_TOKEN>
安装
curl -s https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-nucleus-latest.zip > greengrass-nucleus-latest.zip && unzip greengrass-nucleus-latest.zip -d GreengrassInstaller
sudo -E java -Droot="/greengrass/v2" -Dlog.store=FILE -jar ./GreengrassInstaller/lib/Greengrass.jar --aws-region us-west-2 --thing-name GreengrassQuickStartCore-19401e97f32 --component-default-user ggc_user:ggc_group --provision true --setup-system-service true --deploy-dev-tools true
查log:sudo tail -f /greengrass/v2/logs/greengrass.log
赋予权限
sudo visudo
将root ALL=(ALL) ALL 修改为 root ALL=(ALL:ALL) ALL
常用命令
sudo systemctl stop greengrass.service
sudo systemctl disable greengrass.service
sudo rm /etc/systemd/system/greengrass.service
sudo systemctl daemon-reload && sudo systemctl reset-failed
sudo rm -rf /greengrass/v2