Install the Greengrass CLI을 따라 아래와 같이 Greengrass cli를 설치합니다.
- [AWS IoT Console] - [Greengrass devices] - [Component]로 진입하여 "Public compenents"중에 "aws.greengrass.Cli"을 선택합니다.
- [aws.greengrass.Cli]에서 아래처럼 "Deploy"를 선택하여
- [Create new deployment]를 선택합니다.
- [Specify target]에서 [Target type]으로 "Thing group"을 선택하고, [Target name]으로 생성한 group 이름을 선택합니다. 여기서는 기 생성한 "GreengrassGroup"을 선택합니다. 이후 [Next]를 선택합니다.
-
이후 [Select components]에 "aws.greengrass.Cli"가 선택되었는지 확인 후, [Next]를 선택합니다.
-
[Configure components]에서 Selected components에 "aws.greengrass.Cli" 확인후 [Next]를 선택합니다.
-
[Configure advanced settings - optional에서도 마찬가지로 [Next]를 선택합니다.
- [Review]후에 [Deploy]를 선택합니다.
이후 아래처럼 Deployment가 실행되어서, device가 online이라면 설치가 수행됩니다.
- [IoT job]을 선택하여 들어가면 아래처럼
$ /greengrass/v2/bin/greengrass-cli -V
bash: /greengrass/v2/bin/greengrass-cli: No such file or directory
설치가 잘되면 아래처럼 확인이 가능합니다.
$ /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.
아래처럼 Greengrass Core 디바이스의 components 목록을 확인 할 수 있습니다.
$ sudo /greengrass/v2/bin/greengrass-cli component list
Jun 12, 2022 4:46:32 PM software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection$1 onConnectionSetup
INFO: Socket connection /greengrass/v2/ipc.socket:8033 to server result [AWS_ERROR_SUCCESS]
Jun 12, 2022 4:46:32 PM software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection$1 onProtocolMessage
INFO: Connection established with event stream RPC server
Components currently running in Greengrass:
Component Name: FleetStatusService
Version: null
State: RUNNING
Configuration: null
Component Name: aws.greengrass.Nucleus
Version: 2.5.6
State: FINISHED
Configuration: {"awsRegion":"ap-northeast-2","componentStoreMaxSizeBytes":"10000000000","deploymentPollingFrequencySeconds":"15","envStage":"prod","fleetStatus":{"periodicStatusPublishIntervalSeconds":86400.0},"greengrassDataPlanePort":"8443","httpClient":{},"iotCredEndpoint":"c198kakbg1m4dh.credentials.iot.ap-northeast-2.amazonaws.com","iotDataEndpoint":"anr3wll34rul5-ats.iot.ap-northeast-2.amazonaws.com","iotRoleAlias":"GreengrassV2TokenExchangeRoleAlias","jvmOptions":"-Dlog.store=FILE","logging":{},"mqtt":{"spooler":{}},"networkProxy":{"proxy":{}},"platformOverride":{},"runWithDefault":{"posixUser":"ggc_user:ggc_group"},"telemetry":{}}
Component Name: DeploymentService
Version: 0.0.0
State: RUNNING
Configuration: null
Component Name: UpdateSystemPolicyService
Version: 0.0.0
State: RUNNING
Configuration: null
Component Name: TelemetryAgent
Version: 0.0.0
State: RUNNING
Configuration: null
Component Name: aws.greengrass.Cli
Version: 2.5.6
State: RUNNING
Configuration: {"AuthorizedPosixGroups":null,"AuthorizedWindowsGroups":null}
arn:aws:iot:ap-northeast-2:account-id:thing/GreengrassCore
arn:aws:iot:ap-northeast-2:account-id:thinggroup/GreengrassGroup