By using AWS re:Post, you agree to the Terms of Use
/AWS IoT Core/

Questions tagged with AWS IoT Core

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Simple IoT Core thing rule and SiteWise property ingestion config

Hi, I am seeking some basic plain english assistance please. Any assistance will be great appreciated. I have a temperature sensor Thing receiving MQTT data. * The Things name is: TestThing * The data includes 4 fields: "TS", "datetime", "class", "data" * The published Topic is: TestTopic * The IoT Core MQTT Test Client payload displays as: {"TS": 1656941515, "datetime": 04/07/2022 23:31:55, "class": Temperature, "data": 11} I do not know how to fill out the IoT Core rule correctly, and I am also not sure if the SiteWise Asset propertyAlias is correct. Based on what i have read (see below), the latest failure is: **IoT Core Rule config UI** * SQL Statement: SELECT * FROM 'TestTopic' * Property Alias: TestTopic * Time in seconds: ${TS} * Data type: DOUBLE * Value: ${data} * IAM role: created via the UI - create new role I have used Data type: DOUBLE although i note the incoming data is seen within IoT Analytics as integer. The SiteWise model Measurement definitions is also set to DOUBLE **SiteWise config** * Model Measurement definitions: Temperature * Asset Measurement: Temperature * Asset Measurement - Temperature field (enter a property alias): TestTopic I believe i have created the model and asset correctly. Although, I am not sure if i understand the what exactly is the Property, and thus the propertyAlias. based on the above, I believe i created the propertyAlias for the Temperature field as: TestTopic **Setup and read history** The setup is super simple for testing. A single IoT thing, pulling in MQTT topic data. The Thing was created as a single Thing with certificates. A MODBUS sensor connected to a gateway with MQTT. No OPC server, no Greengrass, no Lora. IoT Analytics and AWS QuickSight services can access the data. I have read: 1) all the AWS suggested questions, 2) the manual - docs pages on SiteWise IoT Core data ingestion, including the tutorial section, 3) the AWS workshop pages, 4) watch every wonderful Youtube on the topic (not many). Key articles read: https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-data-from-iot-things.html https://docs.aws.amazon.com/iot/latest/developerguide/iotsitewise-rule-action.html https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html https://docs.aws.amazon.com/iot-sitewise/latest/userguide/iot-rules.html https://iot-sitewise.workshop.aws/en/40_aws-iot-sitewise-data-ingestion.html https://repost.aws/tags/TAGaSyCvg-SI2w6FYqm1H2RQ/aws-io-t-site-wise
0
answers
0
votes
5
views
asked 18 hours ago

Unable to provision IOT Devices using FleetProvisioningByClaim

I am trying to provision a new device using fleetProvisioningByClaim following https://docs.aws.amazon.com/greengrass/v2/developerguide/fleet-provisioning.html, for this i have all my claim credentials on the device and my iotDataEndpoint/iotCredentialEndpoint/provisioningTemplate/rootCaPath are set and on running the final command `sudo -E java -Droot="/greengrass/v2` i did received Successfully set up Nucleus as a system service and greengrass is running as well but couldn't find the device on iotCore, and as checked in my greengrass.log, attached logs for the same. Also my nucleus and main.log files are empty. Is there any other way to debug such issue? config.yaml file ``` services: aws.greengrass.Nucleus: version: "2.5.6" configuration: awsRegion: "us-east-1" aws.greengrass.FleetProvisioningByClaim: configuration: rootPath: /greengrass/v2 awsRegion: "us-east-1" iotDataEndpoint: "$iotDataEndpoint" // replaced with endpoint as retrieved from aws iot describe-endpoint --endpoint-type iot:Data-ATS iotCredentialEndpoint: "$iotCredentialEndpoint" // replaced with endpoint as retrieved from aws iot describe-endpoint --endpoint-type iot:CredentialProvider iotRoleAlias: "GreengrassV2TokenExchangeRoleAlias" provisioningTemplate: "$provisioningTemplate" // Value as copied from `Fleet provisioning templates` in IOT Core claimCertificatePath: "/greengrass/v2/claim-certs/claim.pem.crt" // copied from certificatePem as mentioned in https://tiny.amazon.com/n4qhu1jm/docsawsamaziotlateapirAPI_ claimCertificatePrivateKeyPath: "/greengrass/v2/claim-certs/claim.private.pem.key" // copied from keyPair.privateKey as mentioned in https://tiny.amazon.com/n4qhu1jm/docsawsamaziotlateapirAPI_ rootCaPath: "/greengrass/v2/AmazonRootCA1.pem" // verified they are present templateParameters: ThingName: "$thingName" // replaced $thingName with my thing name ThingGroupName: "$thingGroupName" // replaced $thingName with my group name ``` Java command: ``` sudo -E java -Droot="/greengrass/v2" -Dlog.store=FILE \ -jar /target/GreengrassInstaller/lib/Greengrass.jar \ --trusted-plugin /target/GreengrassInstaller/aws.greengrass.FleetProvisioningByClaim.jar \ --init-config /target/GreengrassInstaller/config.yaml \ --component-default-user ggc_user:ggc_group \ --setup-system-service true ``` greengrass.log: ``` 2022-07-03T14:33:00.260Z [ERROR] (pool-2-thread-1) com.aws.greengrass.FleetProvisioningByClaimPlugin: Exception encountered while getting device identity information. {} software.amazon.awssdk.crt.CrtRuntimeException: aws_tls_ctx_options_init_client_mtls_from_path failed (aws_last_error: AWS_ERROR_INVALID_ARGUMENT(34), An invalid argument was passed to a function.) AWS_ERROR_INVALID_ARGUMENT(34) at software.amazon.awssdk.crt.io.TlsContextOptions.tlsContextOptionsNew(Native Method) at software.amazon.awssdk.crt.io.TlsContextOptions.getNativeHandle(TlsContextOptions.java:108) at software.amazon.awssdk.crt.io.TlsContext.<init>(TlsContext.java:24) at software.amazon.awssdk.crt.io.ClientTlsContext.<init>(ClientTlsContext.java:26) at software.amazon.awssdk.iot.AwsIotMqttConnectionBuilder.build(AwsIotMqttConnectionBuilder.java:619) at com.aws.greengrass.MqttConnectionHelper.getMqttConnection(MqttConnectionHelper.java:66) at com.aws.greengrass.FleetProvisioningByClaimPlugin.updateIdentityConfiguration(FleetProvisioningByClaimPlugin.java:142) at com.aws.greengrass.lifecyclemanager.KernelLifecycle.lambda$executeProvisioningPlugin$1(KernelLifecycle.java:199) at com.aws.greengrass.util.RetryUtils.runWithRetry(RetryUtils.java:50) at com.aws.greengrass.lifecyclemanager.KernelLifecycle.lambda$executeProvisioningPlugin$2(KernelLifecycle.java:198) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) ```
1
answers
0
votes
17
views
asked 2 days ago

Old data not inserted into Timestream: RejectedRecordsException

Hello! We have an IoT Core Rule which is fired when a MQTT message is published to certain topic. The message structure is: ``` { "triggers": ["door"], "datetime": "2022-06-01T00:00:00Z", "errCodes": [100], "strength": 107, "net": "GMS", "eco": 0, "light": 0, "def": 0, "fan": 0, "defrost": 1, "Mdef": 0, "comp": 0, "door": 0, "Tcond": 38.1, "Tevap": 1, "Tint": 3.8, "topic": "abc/ar/data/NVC1/test-vscode-3" } ``` We have a requirement where data buffered in remote devices could be sent to IoT Core, so we need to send a "datetime" field (the second one) in the payload. The Iot Core Rule fires a AWS Lambda function, which generates a multi-measure record to be finally sent to Timestream: ``` { "Dimensions":[ { "Name":"hw_model", "Value":"NVC1" }, { "Name":"serial_device", "Value":"test-vscode-3" } ], "MeasureName":"multimeasuredata", "MeasureValueType":"MULTI", "MeasureValues":[ { "Name":"Tint", "Value":"3.8", "Type":"DOUBLE" }, { "Name":"Tevap", "Value":"1", "Type":"DOUBLE" } ], "Time":"1654041600000" } ``` The Timestream table retention periods are: Memory store retention: 45 days Magnetic store retention: 180 days Magnetic store writes: ENABLED The exception thrown is: ``` { "errorType":"RejectedRecordsException", "errorMessage":"One or more records have been rejected. See RejectedRecords for details.", "name":"RejectedRecordsException", "$fault":"client", "$metadata":{ "httpStatusCode":419, "requestId":"VKL72WIIMCBGQNWMMSQLK7CAAQ", "attempts":1, "totalRetryDelay":0 }, "RejectedRecords":[ { "Reason":"The record timestamp is outside the time range [2022-06-17T15:21:13.756Z, 2022-06-27T22:51:04.174Z) of the data ingestion window.", "RecordIndex":0 } ], "__type":"com.amazonaws.timestream.v20181101#RejectedRecordsException", "message":"One or more records have been rejected. See RejectedRecords for details.", "stack":[ "RejectedRecordsException: One or more records have been rejected. See RejectedRecords for details.", " at deserializeAws_json1_0RejectedRecordsExceptionResponse (/var/task/node_modules/@aws-sdk/client-timestream-write/dist-cjs/protocols/Aws_json1_0.js:947:23)", " at deserializeAws_json1_0WriteRecordsCommandError (/var/task/node_modules/@aws-sdk/client-timestream-write/dist-cjs/protocols/Aws_json1_0.js:888:25)", " at processTicksAndRejections (node:internal/process/task_queues:96:5)", " at async /var/task/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24", " at async /var/task/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:11:20", " at async StandardRetryStrategy.retry (/var/task/node_modules/@aws-sdk/middleware-retry/dist-cjs/StandardRetryStrategy.js:51:46)", " at async /var/task/node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:6:22", " at async Runtime.exports.handler (/var/task/lambda.js:58:20)" ] } ``` We are not falling out the memory retention period (45 days) in this example (27 days), but the range returned in the exception is (IDK why) [2022-06-17T15:21:13.756Z, 2022-06-27T22:51:04.174Z) Do you have any ideas of why this is the range and hence why the record cannot be inserted? Thanks !
1
answers
0
votes
30
views
asked 7 days ago

Using AWS basic Station, found TX power to be 0.0dBm EIRP

After my test, the power of TX will be 12dBm, the lowest power of SX1301, Generally, transmission power is a parameter that is controlled by the LNS. I guess there is a server configuration problem or there is a problem with my configuration file, Am I missing something important? ``` 2022-06-22 01:57:17.532 [S2E:INFO] TX ::0 diid=39028 [ant#0] - on air: 925.7MHz 0.0dBm ant#0(0) DR10 SF10/BW500 frame=20309C905190DF9AD2E59C5E..DE87E47C ``` Check out this link for testing information: https://github.com/lorabasics/basicstation/issues/161 Or is there any other relevant information I can continue to provide, station.conf ``` { /* If slaave-X.conf present this acts as default settings */ "SX1301_conf": { /* Actual channel plan is controlled by server */ "lorawan_public": true, /* is default */ "clksrc": 1, /* radio_1 provides clock to concentrator */ /* path to the SPI device, un-comment if not specified on the command line e.g., RADIODEV=/dev/spidev0.0 */ "device": "/dev/spidev1.0", /* freq/enable provided by LNS - only HW specific settings listed here */ "radio_0": { "type": "SX1257", "rssi_offset": -166.0, "tx_enable": true, "antenna_gain": 0 }, "radio_1": { "type": "SX1257", "rssi_offset": -166.0, "tx_enable": false } /* chan_multiSF_X, chan_Lora_std, chan_FSK provided by LNS */ }, "station_conf": { "routerid":"a84041ffff1eeb34", "radio_init": "rinit.sh", "RADIO_INIT_WAIT": "5s", "RX_POLL_INTV": "10ms", "TC_TIMEOUT": "360s", "log_file": "stderr", "log_level": "DEBUG", /* XDEBUG,DEBUG,VERBOSE,INFO,NOTICE,WARNING,ERROR,CRITICAL */ "log_size": 10000000, "log_rotate": 3, "CUPS_RESYNC_INTV": "1s" } } ```
1
answers
0
votes
24
views
asked 8 days ago

Measuraments not reported in Iot SiteWise

Hi, I have followed the tutorial [here](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-data-from-iot-things.html). I can see my data in IoT core, but the measurement are not reported in IoT SiteWise. There seem to be a permission problem. This is the error from the error rule ``` { "ruleName": "SiteWiseTutorialDeviceRule", "topic": "$aws/things/SiteWiseTutorialDevice1/shadow/update/accepted", "cloudwatchTraceId": "e3aec656-d5d7-b500-5558-d51ae7aee895", "clientId": "N/A", "base64OriginalPayload": "eyJzdGF0ZSI6eyJyZXBvcnRlZCI6eyJ0ZW1wZXJhdHVyZSI6MTAuMSwiaHVtaWRpdHkiOjY0LjIsInRpbWVzdGFtcCI6MS42NTU3OTk2MjQ0NTczODFFOX19LCJtZXRhZGF0YSI6eyJyZXBvcnRlZCI6eyJ0ZW1wZXJhdHVyZSI6eyJ0aW1lc3RhbXAiOjE2NTU3OTk2MjR9LCJodW1pZGl0eSI6eyJ0aW1lc3RhbXAiOjE2NTU3OTk2MjR9LCJ0aW1lc3RhbXAiOnsidGltZXN0YW1wIjoxNjU1Nzk5NjI0fX19LCJ2ZXJzaW9uIjo5NjAsInRpbWVzdGFtcCI6MTY1NTc5OTYyNCwiY2xpZW50VG9rZW4iOiIyYzU2Zjg1NC0zM2IzLTQzNmQtYjJjZC1kMzk2ZmZkNTYxMGYifQ==", "failures": [ { "failedAction": "IotSiteWiseAction", "failedResource": "", "errorMessage": "Failed to send message data to IoT SiteWise asset properties. [Code: AccessDeniedException, Message: User: arn:aws:sts::908401988620:assumed-role/SiteWiseTutorialDeviceRuleRole/9SUxG6SG is not authorized to perform: iotsitewise:BatchPutAssetPropertyValue on resource: /tutorial/device/SiteWiseTutorialDevice1/temperature because no identity-based policy allows the iotsitewise:BatchPutAssetPropertyValue action]. Message arrived on: $aws/things/SiteWiseTutorialDevice1/shadow/update/accepted, Action: iotSiteWise" } ] } ``` Any suggestion?
1
answers
0
votes
24
views
asked 14 days ago

Accessing Custom Environment Variables inside component's docker containers

I have a manifest file which looks like : ``` { "Platform": { "os": "all" }, "Lifecycle": { "Setenv": { "ENDPOINT": "Test_endpoint" }, "Run": "docker rm core -f && docker rm A -f && docker rm B -f && docker rm C -f && docker-compose -f {artifacts:path}/docker-compose.yml up -d" }, "Artifacts": [ { "URI": "docker:D" }, { "URI": "s3://bucket/docker-compose.yml" }, { "URI": "docker:C" }, { "URI": "docker:B" }, { "URI": "docker:A" } ] } ``` and in docker compose file ``` service: image: "XXXXX.dkr.ecr.us-east-1.amazonaws.com/service-1.0:latest" container_name: service network_mode: host environment: AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT: ${AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT} SVCUID: ${SVCUID} AWS_CONTAINER_CREDENTIALS_FULL_URI: ${AWS_CONTAINER_CREDENTIALS_FULL_URI} AWS_CONTAINER_AUTHORIZATION_TOKEN: ${AWS_CONTAINER_AUTHORIZATION_TOKEN} AWS_REGION: ${AWS_REGION} AWS_IOT_THING_NAME: ${AWS_IOT_THING_NAME} ENDPOINT: ${ENDPOINT} depends_on: - core - ledservice - scannerservice volumes: - ${AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT}:${AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT} command: --uri localhost:4400 --port 9100 --name stow ``` But i am unable to retrieve the value of ENDPOINT in my docker container using System.getEnv("ENDPOINT") or print all the environment variable using printenv on SSH. Value being returned is 'ENDPOINT=' i.e. empty. What am i doing wrong here? because i could not find much references where Setenv is being used or how to use it using docker.
1
answers
0
votes
58
views
asked 24 days ago

Error when requesting thing shadow - TOO_MANY_REQUESTS

I'm getting error with TOO_MANY_REQUESTS code when requesting thing shadow in a server connection. I think this error is caused by a quota exceeds, but I don't know what is the specific quota. If it is the case, can anyone help me to understand what is the quota my server is exceeding? Bellow is the part of stack trace error ``` Caused by: com.amazonaws.services.iot.client.AWSIotException: TOO_MANY_REQUESTS at com.amazonaws.services.iot.client.core.AwsIotCompletion.get(AwsIotCompletion.java:213) ~[aws-iot-device-sdk-java-1.3.4.jar!/:na] at com.amazonaws.services.iot.client.shadow.AwsIotDeviceCommand.get(AwsIotDeviceCommand.java:58) ~[aws-iot-device-sdk-java-1.3.4.jar!/:na] at com.amazonaws.services.iot.client.shadow.AwsIotDeviceCommandManager.runCommand(AwsIotDeviceCommandManager.java:135) ~[aws-iot-device-sdk-java-1.3.4.jar!/:na] at com.amazonaws.services.iot.client.shadow.AwsIotDeviceCommandManager.runCommandSync(AwsIotDeviceCommandManager.java:108) ~[aws-iot-device-sdk-java-1.3.4.jar!/:na] at com.amazonaws.services.iot.client.shadow.AbstractAwsIotDevice.get(AbstractAwsIotDevice.java:93) ~[aws-iot-device-sdk-java-1.3.4.jar!/:na] at com.amazonaws.services.iot.client.AWSIotDevice.get(AWSIotDevice.java:299) ~[aws-iot-device-sdk-java-1.3.4.jar!/:na] at com.kl.compatec.app.central.iot.service.impl.AwsCentralIoTServiceImpl.loadCentralShadow(AwsCentralIoTServiceImpl.java:78) [classes!/:1.0.0] ... 121 common frames omitted ```
1
answers
0
votes
13
views
asked 25 days ago

Embedded C SDK: Not Getting SHADOW_ACKs, only SHADOW_TIMEOUTs -- aws_iot_shadow functions not triggering Callback Function

I have been referred here by TI Support given that my issue seems to be caused by AWS Embedded C SDK. I am using CC3235S evaluation board. I have had success publishing, subscribing, and updating, Shadows/Topics but receiving JSON payloads from a published topic has been a challenge. I am setting breakpoints in my callback function, and they are never being hit, unless I set my timeout seconds to 0, which results in an immediate timeout. The callback is expected to be called upon Timeout, Rejected, or Accepted statuses. My thing/shadow/get/accepted Topic IS Publishing. The problem is that I'm unable to capture it into my Microcontroller. I also can tell you that my AWS Iot Core / Thing policies are not the problem. I have set my permissions as loose as possible for testing. I have Confirmed that the client IS Subscribing to the /shadow/get/rejected + /accepted topics, and I've confirmed that the Shadow is getting updated form my Device/Thing. I have tried: - Adding aws_iot_shadow_yield() / aws_iot_mqtt_yield() after my GET and UPDATE functions - Different timeouts - Setting persistent subscribe argument to true and false - Adjusting permissions then reverting them back to known good The Return Code always returns SUCCESS for all my aws functions within this routine, and during the GET function I have confirmed that the client IS Connected to AWS. My GET Function: ``` IoT_Error_t rcGS; rcGS = aws_iot_shadow_get(&client, AWS_IOT_MY_THING_NAME, getShadowCallback, NULL, 5, true); ``` My GET function Callback: ``` static void getShadowCallback(const char *pThingName, ShadowActions_t action, Shadow_Ack_Status_t status, const char *pReceivedJsonDocument, void *pContextData){ IOT_UNUSED(action); IOT_UNUSED(pContextData); IOT_UNUSED(pReceivedJsonDocument); IOT_UNUSED(pThingName); nop; // breakpoint if (SHADOW_ACK_TIMEOUT == status) { IOT_INFO("GET Timeout--"); } else if (SHADOW_ACK_REJECTED == status) { IOT_INFO("GET RejectedXX"); } else if (SHADOW_ACK_ACCEPTED == status) { IOT_INFO("GET Accepted !!"); GetFromAWS = true; }else{ IOT_INFO("Unknown Update Status"); } } ``` I appreciate any help. Thank you.
2
answers
0
votes
16
views
asked a month ago

Unable to connect to AWS service[API Gateway] from IOT Core device[Inside docker container]

I have created a component using GreengrassV2 and running multiple containers inside this component. Now, my requirement is to call API Gateway and fetch some data into one of the docker containers running on the local device inside the component. I am using "import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;" for fetching the credentials but getting ``` 05:45:06.476 INFO - Calling API Gateway with request params com.amazon.spiderIoT.stowWorkcell.entities.ApiGatewayRequest@e958e637 Exception in thread "main" com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), WebIdentityTokenCredentialsProvider: To use assume role profiles the aws-java-sdk-sts module must be on the class path., com.amazonaws.auth.profile.ProfileCredentialsProvider@7c36db44: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@6c008c24: Failed to connect to service endpoint: ] at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:136) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.getCredentialsFromContext(AmazonHttpClient.java:1269) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.runBeforeRequestHandlers(AmazonHttpClient.java:845) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:794) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:781) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:755) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:715) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:697) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:561) at com.amazon.spiderIoT.stowWorkcell.client.ApiGatewayClient.execute(ApiGatewayClient.java:134) at com.amazon.spiderIoT.stowWorkcell.client.ApiGatewayClient.execute(ApiGatewayClient.java:79) at com.amazon.spiderIoT.stowWorkcell.StowWorkcellService.startMQTTSubscriberForSortLocationEvents(StowWorkcellService.java:120) at com.amazon.spiderIoT.stowWorkcell.StowWorkcellService.onInitialize(StowWorkcellService.java:65) at com.amazon.spideriot.sdk.service.Service.run(Service.java:79) at com.amazon.spiderIoT.stowWorkcell.StowWorkcellServiceDriver.main(StowWorkcellServiceDriver.java:26) ``` My dependencyConfiguration looks like :- ``` { "aws.greengrass.TokenExchangeService": { "componentVersion": "2.0.3", "DependencyType": "HARD" }, "aws.greengrass.DockerApplicationManager": { "componentVersion": "2.0.4" }, "aws.greengrass.Cloudwatch": { "componentVersion": "3.0.0" }, "aws.greengrass.Nucleus": { "componentVersion": "2.4.0", "configurationUpdate": { "merge": "{\"logging\":{\"level\":\"INFO\"}, \"iotRoleAlias\": \"GreengrassV2TestCoreTokenExchangeRoleAlias\"}" } }, "aws.greengrass.LogManager": { "componentVersion": "2.2.3", "configurationUpdate": { "merge": "{\"logsUploaderConfiguration\":{\"systemLogsConfiguration\": {\"uploadToCloudWatch\": \"true\",\"minimumLogLevel\": \"INFO\",\"diskSpaceLimit\": \"10\",\"diskSpaceLimitUnit\": \"MB\",\"deleteLogFileAfterCloudUpload\": \"false\"},\"componentLogsConfigurationMap\": {\"LedService\": {\"minimumLogLevel\": \"INFO\",\"diskSpaceLimit\": \"20\",\"diskSpaceLimitUnit\": \"MB\",\"deleteLogFileAfterCloudUpload\": \"false\"}}},\"periodicUploadIntervalSec\": \"5\"}" } } } ``` Java code for using AWS credentials ``` public class APIGatewayModule extends AbstractModule { @Provides @Singleton public AWSCredentialsProvider getAWSCredentialProvider() { return new DefaultAWSCredentialsProviderChain(); } @Provides @Singleton public ApiGatewayClient getApiGatewayClient(final AWSCredentialsProvider awsCredentialsProvider) { System.out.println("Getting client configurations"); final com.amazonaws.ClientConfiguration clientConfiguration = new com.amazonaws.ClientConfiguration(); System.out.println("Got client configurations" + clientConfiguration); return new ApiGatewayClient(clientConfiguration, Region.getRegion(Regions.fromName("us-east-1")), awsCredentialsProvider, AmazonHttpClient.builder().clientConfiguration(clientConfiguration).build()); } } ``` I have been following this doc: https://docs.aws.amazon.com/greengrass/v2/developerguide/device-service-role.html My question is regarding everywhere in this document, it is mentioned that "AWS IoT Core credentials provider", what credentials provider should we use? Also, as mentioned in this doc we should use --provision true when "When you run the AWS IoT Greengrass Core software, you can choose to provision the AWS resources that the core device requires." But we started without this flag, how can this be tackled and is there any other document that provides reference to using credentials provider and calling API Gateway from AWS SDK Java. On SSH to docker, i could find that the variable is set ``` AWS_CONTAINER_CREDENTIALS_FULL_URI=http://localhost:38135/2016-11-01/credentialprovider/ ``` But unable to curl from docker to this URL, is this how this is suppose to work?
3
answers
0
votes
47
views
asked a month ago

Connecting to AWS IoT is taking for ever with ESP32

I tried connecting to AWS IoT using ESP32 with DTH11 sensor. After uploading the sketch to ESP32 and watching Serial monitor, I can see it connecting to WiFi and then it is taking for ever to connect to AWS. Here is the output: ``` 19:13:50.257 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) 19:13:50.257 -> configsip: 0, SPIWP:0xee 19:13:50.257 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 19:13:50.290 -> mode:DIO, clock div:1 19:13:50.290 -> load:0x3fff0018,len:4 19:13:50.290 -> load:0x3fff001c,len:1216 19:13:50.290 -> ho 0 tail 12 room 4 19:13:50.290 -> load:0x40078000,len:10944 19:13:50.290 -> load:0x40080400,len:6388 19:13:50.290 -> entry 0x400806b4 19:13:50.689 -> Connecting to Wi-Fi 19:13:51.188 -> .....Connected to the WiFi network 19:13:53.182 -> Connecting to AWS IOT 19:13:53.581 -> ...................................................................................................................................................................................................... ``` I ran `openssl s_client -connect custom_endpoint.iot.aws-region.amazonaws.com:8443 -CAfile CA.pem -cert cert.pem -key privateKey.pem` with downloaded certificates from AWS to confirm that are fine and the handshake is happening. ``` SSL handshake has read 5529 bytes and written 1609 bytes Verification: OK ``` How could I debug further? Here is the sketch I am using... ``` #include "secrets.h" #include <WiFiClientSecure.h> #include <PubSubClient.h> #include <ArduinoJson.h> #include "WiFi.h" #include "DHT.h" #define DHTPIN 13 // Digital pin connected to the DHT sensor #define DHTTYPE DHT11 // DHT 11 #define AWS_IOT_PUBLISH_TOPIC "esp32/pub" #define AWS_IOT_SUBSCRIBE_TOPIC "esp32/sub" float h ; float t; DHT dht(DHTPIN, DHTTYPE); WiFiClientSecure net = WiFiClientSecure(); PubSubClient client(net); void connectAWS() { WiFi.mode(WIFI_STA); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.println("Connecting to Wi-Fi"); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("Connected to the WiFi network"); // Configure WiFiClientSecure to use the AWS IoT device credentials net.setCACert(AWS_CERT_CA); net.setCertificate(AWS_CERT_CRT); net.setPrivateKey(AWS_CERT_PRIVATE); // Connect to the MQTT broker on the AWS endpoint we defined earlier client.setServer(AWS_IOT_ENDPOINT, 8883); // Create a message handler client.setCallback(messageHandler); Serial.println("Connecting to AWS IOT"); while (!client.connect(THINGNAME)) { Serial.print("."); delay(100); } if (!client.connected()) { Serial.println("AWS IoT Timeout!"); return; } // Subscribe to a topic client.subscribe(AWS_IOT_SUBSCRIBE_TOPIC); Serial.println("AWS IoT Connected!"); } void publishMessage() { StaticJsonDocument<200> doc; doc["humidity"] = h; doc["temperature"] = t; char jsonBuffer[512]; serializeJson(doc, jsonBuffer); // print to client client.publish(AWS_IOT_PUBLISH_TOPIC, jsonBuffer); } void messageHandler(char* topic, byte* payload, unsigned int length) { Serial.print("incoming: "); Serial.println(topic); StaticJsonDocument<200> doc; deserializeJson(doc, payload); const char* message = doc["message"]; Serial.println(message); } void setup() { Serial.begin(115200); connectAWS(); dht.begin(); } void loop() { h = dht.readHumidity(); t = dht.readTemperature(); if (isnan(h) || isnan(t) ) // Check if any reads failed and exit early (to try again). { Serial.println(F("Failed to read from DHT sensor!")); return; } Serial.print(F("Humidity: ")); Serial.print(h); Serial.print(F("% Temperature: ")); Serial.print(t); Serial.println(F("°C ")); publishMessage(); client.loop(); delay(1000); } ``` I have referred following url [https://how2electronics.com/connecting-esp32-to-amazon-aws-iot-core-using-mqtt/]()
3
answers
0
votes
26
views
asked a month ago

AWS IoT Greengrass (V2) and Video Streaming

Hello, The use case I have is this - There are two types of AWS IoT Greengrass V2 core devices that are implemented, which are connected (in the same private LAN network) in hub and spoke architecture. None of them are connected to client devices (Greengrass is being used because of its IPC and orchestration benefits): 1. [Spoke] AWS IoT Greengrass V2 core device is directly attached to a camera. The Video stream is sent to an Hub AWS IoT Greengrass V2 core device for ML processing (inference) that must be near-real time. 2. [Hub] AWS IoT Greengrass V2 core device that is processing and Fan-Out video streams: **A)** to ML inference interface (**local component of the hub**) **B)** to Kinesis Firehose (S3; to re-train the model) **C)** AWS Kinesis Video Stream (for human to view the video online) I have a couple of questions: 1. Is the architecture feasible? Make sense? 2. What is the best (performance and security wise) technology (open source, AWS component, protocol) to use in Spoke and Hub devices to send the video stream from the spokes to the hub (the video has to be high quality with minimal/no compression to keep the inference accuracy high)? 2. Can the Stream Manager component of AWS IoT Greengrass V2 core send (Hub) streams in fun-out mode (**e.g., to two different destinations concurrently, AWS Kinesis Firehose and AWS Kinesis Video Streams**)? Thank you, Yossi
1
answers
0
votes
55
views
asked a month ago

No module error while trying "Connect to AWS IoT"

I have followed the "Connect to AWS IoT" steps provided in AWS IOT (1.Register a device 2.Download a connection kit 3.Configure and test your device). When I tried to run the script, I am getting `No module named AWSIoTPythonSDK.MQTTLib` Environment: Platform: Linux Choose a AWS IoT Device SDK: Python More info: ``` user::~/Downloads/connect_device_package$ ./start.sh Downloading AWS IoT Root CA certificate from AWS... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1188 100 1188 0 0 7378 0 --:--:-- --:--:-- --:--:-- 7378 Cloning the AWS SDK... Cloning into 'aws-iot-device-sdk-python'... remote: Enumerating objects: 870, done. remote: Counting objects: 100% (135/135), done. remote: Compressing objects: 100% (77/77), done. remote: Total 870 (delta 71), reused 58 (delta 58), pack-reused 735 Receiving objects: 100% (870/870), 334.31 KiB | 1.92 MiB/s, done. Resolving deltas: 100% (423/423), done. Installing AWS SDK... ~/Downloads/connect_device_package/aws-iot-device-sdk-python ~/Downloads/connect_device_package Requirement already satisfied: AWSIoTPythonSDK in /home/om/.local/lib/python3.8/site-packages (1.4.9) ~/Downloads/connect_device_package Running pub/sub sample application... Traceback (most recent call last): File "aws-iot-device-sdk-python/samples/basicPubSub/basicPubSub.py", line 18, in <module> from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient ImportError: No module named AWSIoTPythonSDK.MQTTLib ```
1
answers
0
votes
35
views
asked a month ago

Token Exchange Service (TES) failing to fetch credentials

**Gentlefolks, why is the the token exchange service (TES) failing to fetch credentials?** I have greengrass installed on Ubuntu 20.x.x running on a virtual machine. At the end of the numbered items is an error log (truncated) obtained from `/greengrass/v2/logs/greengrass.log`. Thank you What I've done or what I think you should know: 1. There exist `GreenGrassServiceRole` which contains `AWSGreengrassResourceAccessRolePolicy`, and every other policy containing the word "greengrass" in its name. It also has a trust relationship as below. This was created when I installed Greengrass, but I added additional policies. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "greengrass.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "<MY_ACCOUNT_NUMBER>" }, "ArnLike": { "aws:SourceArn": "<ARN_THAT_SHOWS_MY_REGION_AND_ACC_NUMBER>:*" } } }, { "Effect": "Allow", "Principal": { "Service": "credentials.iot.amazonaws.com" }, "Action": "sts:AssumeRole" } ] } ``` 2. `aws.greengrass.Nucleus` component is deployed with the following configuration update. The alias also exists. ``` { "reset": [], "merge": { "ComponentConfiguration": { "DefaultConfiguration": { "iotRoleAlias": "GreengrassV2TokenExchangeRoleAlias", "awsRegion": "us-east-1", "iotCredEndpoint": "https://sts.us-east-1.amazonaws.com", "iotDataEndpoint": "<ENDPOINT_OBTAINED_FROM_IOT_CORE_SETTINGS>" } } } } ``` 3. `aws.greengrass.TokenExchangeService` is deployed. 4. There's a custom component that uses the Greengrass SDK to publish to IoT Core. It has the following configuration update. ``` { "reset": [], "merge": { "ComponentDependencies": { "aws.greengrass.TokenExchangeService": { "VersionRequirement": "^2.0.0", "DependencyType": "HARD" } } } } ``` 5. There is an IoT policy from a previous exercise which attached to the core device (Ubuntu on virtual machine) certificate. It allows **all** actions. There's also another `GreengrassTESCertificatePolicyGreengrassV2TokenExchangeRoleAlias` which is associated with the thing's certificate. The policy allows `iot:AssumeRoleWithCertificate` **ERROR LOG BELOW** ``` 2022-05-21T21:07:39.592Z [ERROR] (pool-2-thread-28) com.aws.greengrass.tes.CredentialRequestHandler: Error in retrieving AwsCredentials from TES. {iotCredentialsPath=/role-aliases/GreengrassV2TokenExchangeRoleAlias/credentials, credentialData=Failed to get connection} 2022-05-21T21:08:38.071Z [WARN] (pool-2-thread-28) com.aws.greengrass.tes.CredentialRequestHandler: Encountered error while fetching credentials. {iotCredentialsPath=/role-aliases/GreengrassV2TokenExchangeRoleAlias/credentials} com.aws.greengrass.deployment.exceptions.AWSIotException: Unable to get response at com.aws.greengrass.iot.IotCloudHelper.getHttpResponse(IotCloudHelper.java:95) at com.aws.greengrass.iot.IotCloudHelper.lambda$sendHttpRequest$1(IotCloudHelper.java:80) at com.aws.greengrass.util.BaseRetryableAccessor.retry(BaseRetryableAccessor.java:32) at com.aws.greengrass.iot.IotCloudHelper.sendHttpRequest(IotCloudHelper.java:81) at com.aws.greengrass.tes.CredentialRequestHandler.getCredentialsBypassCache(CredentialRequestHandler.java:207) at com.aws.greengrass.tes.CredentialRequestHandler.getCredentials(CredentialRequestHandler.java:328) at com.aws.greengrass.tes.CredentialRequestHandler.getAwsCredentials(CredentialRequestHandler.java:337) at com.aws.greengrass.tes.LazyCredentialProvider.resolveCredentials(LazyCredentialProvider.java:24) at software.amazon.awssdk.awscore.internal.AwsExecutionContextBuilder.resolveCredentials(AwsExecutionContextBuilder.java:165) at software.amazon.awssdk.awscore.internal.AwsExecutionContextBuilder.invokeInterceptorsAndCreateExecutionContext(AwsExecutionContextBuilder.java:102) at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.invokeInterceptorsAndCreateExecutionContext(AwsSyncClientHandler.java:69) at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:78) at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:175) at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76) at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45) at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56) at software.amazon.awssdk.services.s3.DefaultS3Client.getBucketLocation(DefaultS3Client.java:3382) at com.aws.greengrass.componentmanager.builtins.S3Downloader.lambda$getRegionClientForBucket$2(S3Downloader.java:134) at com.aws.greengrass.util.RetryUtils.runWithRetry(RetryUtils.java:50) at com.aws.greengrass.componentmanager.builtins.S3Downloader.getRegionClientForBucket(S3Downloader.java:133) at com.aws.greengrass.componentmanager.builtins.S3Downloader.getDownloadSize(S3Downloader.java:115) at com.aws.greengrass.componentmanager.ComponentManager.prepareArtifacts(ComponentManager.java:420) at com.aws.greengrass.componentmanager.ComponentManager.preparePackage(ComponentManager.java:377) at com.aws.greengrass.componentmanager.ComponentManager.lambda$preparePackages$1(ComponentManager.java:338) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.net.UnknownHostException: https at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:797) at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1509) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1368) at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1302) at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) at jdk.internal.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at software.amazon.awssdk.http.apache.internal.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:80) at com.sun.proxy.$Proxy15.connect(Unknown Source) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at software.amazon.awssdk.http.apache.internal.impl.ApacheSdkHttpClient.execute(ApacheSdkHttpClient.java:72) at software.amazon.awssdk.http.apache.ApacheHttpClient.execute(ApacheHttpClient.java:253) at software.amazon.awssdk.http.apache.ApacheHttpClient.access$500(ApacheHttpClient.java:106) at software.amazon.awssdk.http.apache.ApacheHttpClient$1.call(ApacheHttpClient.java:232) at com.aws.greengrass.iot.IotCloudHelper.getHttpResponse(IotCloudHelper.java:88) ... 27 more 2022-05-21T21:08:38.073Z [ERROR] (pool-2-thread-28) com.aws.greengrass.tes.CredentialRequestHandler: Error in retrieving AwsCredentials from TES. {iotCredentialsPath=/role-aliases/GreengrassV2TokenExchangeRoleAlias/credentials, credentialData=Failed to get connection} ```
2
answers
0
votes
50
views
asked a month ago

MQTT Connection keeps getting disconnected/closed while publishing or subscribing to topics using LTE Modem

- I'm using Quectel modem BG95 with a host MCU to connect to AWS IoT core and publish to topics and subscribe to topics as well. - I used to get an error occasionally that closed the MQTT connection exactly while doing pub/sub operations and connection had to be re-established , but that was very rare. - However, since the last few days I have been running tests on multiple devices (using same IoT core endpoint) and have been getting this MQTT dis-connection on each pub or sub operation. I am attaching a log for review. - To me it seems a server side issue since I have tried it with multiple modems and previous versions of firmware. ``` [While publishing to topic] ;2022-05-08T02:29:41Z;28;-966233403;462863960;;RAK000121|-45,RAKTEST|-56 AT+QIDEACT=1 OK[ 2022-05-08T02:29:41Z ] [FARM_IP][INFO] MDM_SET_DEACTIVATE_PDP-else AT+QIACT=1 OK AT+QMTOPEN=0,"a5u9klmd2viw3z-ats.iot.us-west-1.amazonaws.com",8883 OK +QMTOPEN: 0,0 --- [Opening MQTT Connection] [ 2022-05-08T02:29:41Z ] [FARM_IP][INFO] Mqtt opened AT+QMTCONN=0,"0123qwer786" OK +QMTCONN: 0,0,0 --- [MQTT client connected] AT+QMTPUB=0,1,1,0,"fm/1011",72 --- [Publishing to the MQTT Topic] > ;2022-05-08T02:29:41Z;28;-966233403;462863960;;RAK000121|-45,RAKTEST|-56 OK +QMTSTAT: 0,1 --- [MQTT Connection Closed] ``` ``` [While Subscribing to topic] AT+QMTSUB=0,1,"imei/get_logs",0 --- [Subscribing to the MQTT Topic] OK +QMTSTAT: 0,1 --- [MQTT Connection Closed] [ ] [FARM_IP][INFO] Starting timer AT+QMTSUB=0,1,"imei/get_logs",0 --- [Subscribing to the MQTT Topic] OK +QMTSTAT: 0,1 --- [MQTT Connection Closed] ```
1
answers
0
votes
89
views
asked 2 months ago

IoT Core OpenSearch Action Rule & "Mapper parsing exception"

Hi I was following this [AWS tutorial](https://aws.amazon.com/blogs/mobile/analyze-device-generated-data-with-aws-iot-and-amazon-elasticsearch-service/) but with my own sensor data. I've created the following IoT Core Rule OpenSearch Action: ``` OpenSearchTopicRule: Type: AWS::IoT::TopicRule Properties: TopicRulePayload: Actions: - OpenSearch: Endpoint: !Join ['', ['https://', !GetAtt OpenSearchServiceDomain.DomainEndpoint]] Id: '${newuuid()}' Index: sensors RoleArn: !GetAtt IoTOSActionRole.Arn Type: sensor_data Sql: SELECT *, timestamp() as ts FROM 'Greenhouse/+/Sensor/Status' ``` The IoTOSActionRole has propper es:ESHttpPut permission. But when I try to create an index with following command send from Postman that would match the `Type: sensor_data` attribute: ``` curl --location --request PUT 'https://search-iot***-avt***i.eu-west-1.es.amazonaws.com/sensors' \ --header 'Content-Type: application/json' \ --data-raw '{ "mappings": { "sensor_data": { "properties": { "ts": { "type": "long", "copy_to": "datetime"}, "datetime": {"type": "date", "store": true}, "deviceID": {"type": "text", "store": true}, "humidity": {"type": "integer", "store": true}, "temperature": {"type": "integer", "store": true}, "lux": {"type": "integer", "store": true}, "soil": {"type": "integer", "store": true} }}}' ``` I receive an error: ``` { "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "Root mapping definition has unsupported parameters: [sensor_data : {properties={datetime={store=true, type=date}, temperature={store=true, type=integer}, humidity={store=true, type=integer}, soil={store=true, type=integer}, deviceID={store=true, type=text}, lux={store=true, type=integer}, ts={copy_to=datetime, type=long}}}]" } ], "type": "mapper_parsing_exception", "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [...]", "caused_by": { "type": "mapper_parsing_exception", "reason": "Root mapping definition has unsupported parameters: [...}]" } }, "status": 400 } ``` I've tried removing the 'type' `"sensor_data"` attribute and that allowed me to create an index with that mapping, ``` { "acknowledged": true, "shards_acknowledged": true, "index": "sensors" } ``` and then index pattern in OpenSearch Dashboard, but what happens then is that the IoT Core Rule even though it gets triggered does not result in any data ingestion to the OpenSearch domain. So I guess IoT Core Action tries to send that data with type `sensor_data`but there's no corresponding type in OS. Additionally, when I open the Discovery tab in OS dashboard I get this notice: ``` "undefined" is not a configured index pattern ID Showing the default index pattern: "sensors*" (d97775d0-cc44-11ec-acd4-bf72aa2fd725) ``` I'm using the OpenSearch 1.2 (latest) version. Sample data: ``` { "deviceID": "Tomatoes", "Greenhouse": 1, "date": "05-05", "time": "09:35:39", "timestamp": 1651743339, "humidity": 60, "temperature": 33.3, "lux": 9133.333, "soil": 78 } ``` What PUT call I have to make to create a `sensor_data` type mapping in OS that would match the type specified in IoT Core OpenSearch Action Rule?
1
answers
0
votes
11
views
asked 2 months ago

[Greengrass][IDT] test component and MQTT failed with general info

At current, my Greengrass core device (v2.5.5), is on my rasp 3b+ running normally with manual deployment from local/cloud. However, the IDT (version 4.5.3 with suite=GGV2Q_2.3.1) execution passed for 3/6 test cases as below only: ========== Test Summary ========== * Execution Time: 1m51s * Tests Completed: 6 * Tests Passed: 3 * Tests Failed: 3 * Tests Skipped: 0 ---------------------------------- Test Groups: * pretestvalidation: PASSED * version: PASSED * coredependencies: PASSED * mqtt: FAILED * component: FAILED ---------------------------------- Failed Tests: * Group Name: mqtt Test Name: mqttpubsub; Reason: Failed at 'my device is running Greengrass * Group Name: component Test Name: cloudcomponent; Reason: Failed at 'my device is running Greengrass' Test Name: localcomponent; Reason: Failed at 'my device is running Greengrass' ---------------------------------- **Is there further detail/meaningful info from these error log/code?** **I have tried to look into the log folder but nothing else there.** **I have attached all failed logs as below:** # localcomponent: - time="22:48:06+07:00" level=info msg=22:48:06.237 [localdeployment] [INFO] com.aws.greengrass.testing.features.LoggerSteps - Attaching thread context to scenario: 'A component is deployed locally using CLI' - time="22:48:06+07:00" level=info msg=22:48:06.238 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 4: 'my device is registered as a Thing' - time="22:48:08+07:00" level=info msg=22:48:08.085 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IotPolicy in IotLifecycle - time="22:48:09+07:00" level=info msg=22:48:09.615 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IamPolicy in IamLifecycle - time="22:48:10+07:00" level=info msg=22:48:10.194 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IamRole in IamLifecycle - time="22:48:10+07:00" level=info msg=22:48:10.639 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IotRoleAlias in IotLifecycle - time="22:48:10+07:00" level=info msg=22:48:10.837 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IotPolicy in IotLifecycle - time="22:48:11+07:00" level=info msg=22:48:11.040 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IotThingGroup in IotLifecycle - time="22:48:12+07:00" level=info msg=22:48:12.066 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IotCertificate in IotLifecycle - time="22:48:12+07:00" level=info msg=22:48:12.466 [localdeployment] [INFO] com.aws.greengrass.testing.resources.AbstractAWSResourceLifecycle - Created IotThing in IotLifecycle - time="22:48:14+07:00" level=info msg=22:48:14.966 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 5: 'my device is running Greengrass' - time="22:48:14+07:00" level=info msg=22:48:14.976 [localdeployment] [ERROR] greengrass/features/localdeployment.feature - Failed at step: 'my device is running Greengrass' - time="22:48:14+07:00" level=info msg=com.google.inject.ConfigurationException: Guice configuration errors: - time="22:48:14+07:00" level=info msg=1) [Guice/ErrorInUserCode]: Unable to method intercept: GreengrassSteps - time="22:48:14+07:00" level=info msg= while locating GreengrassSteps - time="22:48:14+07:00" level=info msg=22:48:14.990 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 9: 'I create a Greengrass deployment with components' - time="22:48:14+07:00" level=info msg=22:48:14.990 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 11: 'I deploy the Greengrass deployment configuration' - time="22:48:14+07:00" level=info msg=22:48:14.991 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 12: 'the Greengrass deployment is COMPLETED on the device after 180 seconds' - time="22:48:14+07:00" level=info msg=22:48:14.991 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 13: 'I verify greengrass-cli is available in greengrass root' - time="22:48:14+07:00" level=info msg=22:48:14.991 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 14: 'I create a local deployment with components' - time="22:48:14+07:00" level=info msg=22:48:14.991 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 16: 'the local Greengrass deployment is SUCCEEDED on the device after 120 seconds' - time="22:48:14+07:00" level=info msg=22:48:14.991 [localdeployment] [INFO] greengrass/features/localdeployment.feature - line 17: 'the aws.greengrass.LocalHelloWorld log on the device contains the line "Hello World!!" within 20 seconds' - time="22:48:16+07:00" level=info msg=22:48:16.569 [localdeployment] [INFO] com.aws.greengrass.testing.features.LoggerSteps - Clearing thread context on scenario: 'A component is deployed locally using CLI' - time="22:48:16+07:00" level=info msg=22:48:16.577 [localdeployment] [ERROR] com.aws.greengrass.testing.launcher.reporting.StepTrackingReporting - Failed: 'A component is deployed locally using CLI': Failed at 'my device is running Greengrass' - time="22:48:16+07:00" level=info msg=22:48:16.584 [] [] [INFO] com.aws.greengrass.testing.modules.AWSResourcesCleanupModule - Cleaned up com.aws.greengrass.testing.resources.iam.IamLifecycle$$EnhancerByGuice$$10441879@e128dc2 - time="22:48:23+07:00" level=error msg=Test exited unsuccessfully error=exit status # cloudcomponent: - 2022-May-04 15:37:28,499 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 9: 'I create a Greengrass deployment with components' - 2022-May-04 15:37:28,499 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 11: 'I deploy the Greengrass deployment configuration' - 2022-May-04 15:37:28,500 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 12: 'the Greengrass deployment is COMPLETED on the device after 180 seconds' - 2022-May-04 15:37:28,500 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 13: 'the com.aws.HelloWorld log on the device contains the line "Hello World!!" within 20 seconds' - 2022-May-04 15:37:28,500 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 15: 'I create a Greengrass deployment with components' - 2022-May-04 15:37:28,500 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 17: 'I deploy the Greengrass deployment configuration' - 2022-May-04 15:37:28,500 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 18: 'the Greengrass deployment is COMPLETED on the device after 180 seconds' - 2022-May-04 15:37:28,500 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] greengrass/features/cloudComponent.feature - line 19: 'the com.aws.HelloWorld log on the device contains the line "Hello World Updated!!" within 20 seconds' - 2022-May-04 15:37:31,557 [cloudComponent] [idt-b47156801aee3f29c860] [INFO] com.aws.greengrass.testing.features.LoggerSteps - Clearing thread context on scenario: 'As a developer, I can create a component in Cloud and deploy it on my device' - 2022-May-04 15:37:31,558 [cloudComponent] [idt-b47156801aee3f29c860] [ERROR] com.aws.greengrass.testing.launcher.reporting.StepTrackingReporting - Failed: 'As a developer, I can create a component in Cloud and deploy it on my device': Failed at 'my device is running Greengrass' # mqttpubsub: - 2022-May-04 15:36:55,929 [mqtt] [idt-614fb227a4f0913ba4be] [INFO] greengrass/features/mqtt.feature - line 9: 'I create a Greengrass deployment with components' - 2022-May-04 15:36:55,931 [mqtt] [idt-614fb227a4f0913ba4be] [INFO] greengrass/features/mqtt.feature - line 12: 'I deploy the Greengrass deployment configuration' - 2022-May-04 15:36:55,931 [mqtt] [idt-614fb227a4f0913ba4be] [INFO] greengrass/features/mqtt.feature - line 13: 'the Greengrass deployment is COMPLETED on the device after 180 seconds' - 2022-May-04 15:36:55,931 [mqtt] [idt-614fb227a4f0913ba4be] [INFO] greengrass/features/mqtt.feature - line 14: 'the aws.greengrass.IotMqttSubscriber log on the device contains the line "Subscribed to IoT topic idt/Mqtt/Test with QOS=AT_LEAST_ONCE" within 20 seconds' - 2022-May-04 15:36:55,931 [mqtt] [idt-614fb227a4f0913ba4be] [INFO] greengrass/features/mqtt.feature - line 15: 'the aws.greengrass.IotMqttPublisher log on the device contains the line "Published to IoT topic idt/Mqtt/Test with payload test message and qos AT_LEAST_ONCE" within 10 seconds' - 2022-May-04 15:36:58,922 [mqtt] [idt-614fb227a4f0913ba4be] [INFO] com.aws.greengrass.testing.features.LoggerSteps - Clearing thread context on scenario: 'Component publishes MQTT message to Iot core and retrieves it as well' - 2022-May-04 15:36:58,924 [mqtt] [idt-614fb227a4f0913ba4be] [ERROR] com.aws.greengrass.testing.launcher.reporting.StepTrackingReporting - Failed: 'Component publishes MQTT message to Iot core and retrieves it as well': Failed at 'my device is running Greengrass' - 2022-May-04 15:36:58,930 [] [] [INFO] com.aws.greengrass.testing.modules.AWSResourcesCleanupModule - Cleaned up com.aws.greengrass.testing.resources.s3.S3Lifecycle$$EnhancerByGuice$$11137706@7e3ca22c
4
answers
0
votes
68
views
asked 2 months ago

Java IoT connection kit won't build...

I have successfully created an IoT device and was able to make it work with Windows and Python SDK. I then wanted to see how the Java code worked so I selected Windows and the Java SDK and on this page https://us-east-2.console.aws.amazon.com/iot/home?region=us-east-1#/connectdevice/, clicked next and selected the device which I had already set up and have working in Python. I clicked Next Step and clicked the link to download the Java SDK. I extracted the Java SDK and started a windows Power Shell. I unzipped the downloaded SDK, changed directory to it, ran the change to the execution policy "Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process" and then ran start.ps1. The example fails to build with the error: > [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.373 s [INFO] Finished at: 2022-04-28T15:29:22-07:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project aws-iot-device-sdk-java-samples: Could not resolve dependencies for project com.amazonaws:aws-iot-device-sdk-java-samples:jar:0.0.1-dev: Could not find artifact com.amazonaws:aws-iot-device-sdk-java:jar:0.0.1-dev in central (https://repo.maven.apache.org/maven2) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException Any ideas how to fix this?
1
answers
0
votes
82
views
asked 2 months ago

GG logs are pushed intermittently to cloudwatch

Hello, We are using GreenGrass v2 and would like to have logs pushed as frequently as possible. We understand the limitation for certain components (eg telemetry) but our application logs should be sent as near real time as we can. Currently, regardless of the configurations set our logs are only sent intermittently to CloudWatch. Logs are seen every few hours or even few days. Could anyone please help us understand whats happening? We are using the following configuration: ``` 'aws.greengrass.Nucleus': { componentVersion: '2.4.0', configurationUpdate: { merge: `{ "logging" : { "level" : "DEBUG", "format" : "JSON" } }`, }, }, 'aws.greengrass.LogManager': { componentVersion: '2.2.1', configurationUpdate: { merge: `{ "logsUploaderConfiguration": { "systemLogsConfiguration": { "uploadToCloudWatch": "true", "minimumLogLevel": "DEBUG", "diskSpaceLimit": "2", "diskSpaceLimitUnit": "KB", "deleteLogFileAfterCloudUpload": "true" }, "componentLogsConfigurationMap": { "com.component1": { "minimumLogLevel": "DEBUG", "diskSpaceLimit": "2", "logFileDirectoryPath": "/greengrass/v2/logs/", "logFileRegex": "com.component1\\\\w*.log", "diskSpaceLimitUnit": "KB", "deleteLogFileAfterCloudUpload": "true" }, "com.component2": { "minimumLogLevel": "DEBUG", "diskSpaceLimit": "2", "logFileDirectoryPath": "/greengrass/v2/logs/", "logFileRegex": "com.component2\\\\w*.log", "diskSpaceLimitUnit": "KB", "deleteLogFileAfterCloudUpload": "true" }, "aws.greengrass.SageMakerEdgeManager": { "minimumLogLevel": "DEBUG", "logFileDirectoryPath": "/greengrass/v2/logs/", "logFileRegex": "aws.greengrass.SageMakerEdgeManager\\\\w*.log", "diskSpaceLimit": "2", "diskSpaceLimitUnit": "KB", "deleteLogFileAfterCloudUpload": "true" }, "aws.greengrass.SecureTunneling": { "minimumLogLevel": "DEBUG", "logFileDirectoryPath": "/greengrass/v2/logs/", "logFileRegex": "aws.greengrass.SecureTunneling\\\\w*.log", "diskSpaceLimit": "2", "diskSpaceLimitUnit": "KB", "deleteLogFileAfterCloudUpload": "true" } } }, "periodicUploadIntervalSec": "10" }`, }, }, ```
3
answers
0
votes
13
views
asked 3 months ago

"Getting started with AWS IoT Core" Shadow Python scripts get connection exception

Using "Getting started with AWS IoT Core" to generate Python scripts. The basicPubSub.py sample script works fine. The Shadow examples, basicShadowDetailListener.py, basicShadowUpdater.py and ThingShadowEcho.py all get connection timeout exception when run. 2022-04-03 13:08:49,371 - AWSIoTPythonSDK.core.protocol.mqtt_core - ERROR - Connect timed out Traceback (most recent call last): File "/home/pi/connect_device_package/aws-iot-device-sdk-python/samples/basicShadow/basicShadowDeltaListener.py", line 110, in <module> myAWSIoTMQTTShadowClient.connect() File "/usr/local/lib/python3.9/dist-packages/AWSIoTPythonSDK/MQTTLib.py", line 1278, in connect return self._AWSIoTMQTTClient.connect(keepAliveIntervalSecond) File "/usr/local/lib/python3.9/dist-packages/AWSIoTPythonSDK/MQTTLib.py", line 520, in connect return self._mqtt_core.connect(keepAliveIntervalSecond) File "/usr/local/lib/python3.9/dist-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 199, in connect raise connectTimeoutException() AWSIoTPythonSDK.exception.AWSIoTExceptions.connectTimeoutException The IoT client and Shadow client appear to have the same connection configuration parameters # AWSIoTMQTTShadowClient configuration myAWSIoTMQTTShadowClient.configureAutoReconnectBackoffTime(1, 32, 20) myAWSIoTMQTTShadowClient.configureConnectDisconnectTimeout(10) # 10 sec myAWSIoTMQTTShadowClient.configureMQTTOperationTimeout(5) # 5 sec # AWSIoTMQTTClient connection configuration myAWSIoTMQTTClient.configureAutoReconnectBackoffTime(1, 32, 20) myAWSIoTMQTTClient.configureOfflinePublishQueueing(-1) # Infinite offline Publish queueing myAWSIoTMQTTClient.configureDrainingFrequency(2) # Draining: 2 Hz myAWSIoTMQTTClient.configureConnectDisconnectTimeout(10) # 10 sec myAWSIoTMQTTClient.configureMQTTOperationTimeout(5) # 5 sec
1
answers
0
votes
63
views
asked 3 months ago

Greengrass v2 fleet provisioning retry in case of lack of the Internet connection.

Hi. I have created a Greengrass fleet deployment workflow for my devices which works great - cloud resources are provisioned, claim certs are used to obtain device individual certs, and device gets connected. However in production environment the scenario will be different: 1. An IoT device is installed by an engineer in a newly built home, with no occupiers and no internet connection. 2. The Greengrass is ready to claim device certs and connect as soon as the device is powered up. 3. The device then is powered up by the installing engineer, meaning the Greengrass fleet provisioning plugin will try to do its job, but there is no internet connection, so it will fail. 4. The engineer will leave the device on, and it will be permanently on since now on. 5. The occupiers will move in some time later and install their broadband router, the Internet is now available. At this point, from my tests, I noticed the Greengrass/provisioning plugin won't detect Internet connection and won't try to register the device/obtain certs - meaning there is no retry functionality implemented. I understand that the device can be rebooted or Greengrass service restarted to initialize new registration attempt, however - if possible I'd like to avoid occupiers fiddling with the device, and prefer the device to the retry automatically. I also understand that I can write a software that will be automatically cyclically restarting the Greengrass service if the previous registration attempt failed (probably by checking if the thingCert.crt is present) but before I'll spend my time on coding, **the question is**: Is it possible to configure Greengrass to retry delayed provisioning using claim certificates if previous attempt has failed? Appreciate any help.
1
answers
0
votes
26
views
asked 3 months ago

Verifying Rule destination on AWS IOT for Telegram Bot

I am trying to set up a simple service where I send messages from an edge device towards AWS IOT. AWS IOT then has a rule functionality (https://docs.aws.amazon.com/iot/latest/developerguide/iot-rules.html) that allows me to route that message towards a web app or service. I have managed to do is to send messages to a topic on AWS IOT Core and save them in a S3 Bucket. Now I am trying to set up a rule to route them to Telegram. I followed a Telegram Bot tutorial and obtained a link https://api.telegram.org/bot<bot token>/sendMessage?chat_id=<chat id>&text=<my message>. I have a bot token and chat id entered in. If I substitute <my message> with my personal message and add to that my browser, my telegram channel will get the message. I am trying to have custom messages to my telegram channel based on received messages on MQTT, AWS IoT Rules Engine requires a confirmation that I can access the data sent to that endpoint. The Rules Engine issues a challenge message to the specified endpoint with a token. If I can get the token and send that back to Rules Engine, then I can prove that I have access to the data on the receiving side, which would complete the confirmation process. The message has a format like this: HTTP POST {confirmationUrl}/?confirmationToken={confirmationToken} I am seriously confused how to verify that with the link from Telegram above. According to AWS, if you control that endpoint, you can simply look in your service logs for POST requests to that resource with the confirmationToken URI query, extract that token value, and paste it back into the AWS IoT console. I guess my main questions based on the telegram link I have above would be: 1. What is the HTTPS Endpoint I should enter for my rule action here? 2. What is the Confirmation Url I should enter for my rule action here? 3. How would I check for the confirmation token? I have no idea how to open the service log.
2
answers
0
votes
21
views
asked 3 months ago
  • 1
  • 90 / page