{"id":19244396,"url":"https://github.com/nanoframework/nanoframework.aws.iotcore.devices","last_synced_at":"2026-04-27T03:01:21.686Z","repository":{"id":37930829,"uuid":"417567169","full_name":"nanoframework/nanoFramework.Aws.IoTCore.Devices","owner":"nanoframework","description":":package: .NET nanoFramework AWS IoT Core Devices SDK","archived":false,"fork":false,"pushed_at":"2025-12-18T13:26:16.000Z","size":477,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-21T18:52:19.010Z","etag":null,"topics":["csharp","dotnet","esp32","hacktoberfest","iot","stm32"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanoframework.png","metadata":{"funding":{"open_collective":"nanoframework","github":"nanoframework"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-15T16:30:08.000Z","updated_at":"2025-12-18T13:26:19.000Z","dependencies_parsed_at":"2023-10-16T03:29:05.435Z","dependency_job_id":"bec3badf-b02b-47f1-b493-de9a6288c3b0","html_url":"https://github.com/nanoframework/nanoFramework.Aws.IoTCore.Devices","commit_stats":{"total_commits":271,"total_committers":5,"mean_commits":54.2,"dds":"0.36900369003690037","last_synced_commit":"aa00021513846bdbd1869e0407fcb935380dcdff"},"previous_names":[],"tags_count":149,"template":false,"template_full_name":null,"purl":"pkg:github/nanoframework/nanoFramework.Aws.IoTCore.Devices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Aws.IoTCore.Devices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Aws.IoTCore.Devices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Aws.IoTCore.Devices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Aws.IoTCore.Devices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoframework","download_url":"https://codeload.github.com/nanoframework/nanoFramework.Aws.IoTCore.Devices/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoframework%2FnanoFramework.Aws.IoTCore.Devices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32320683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","esp32","hacktoberfest","iot","stm32"],"created_at":"2024-11-09T17:23:14.699Z","updated_at":"2026-04-27T03:01:21.671Z","avatar_url":"https://github.com/nanoframework.png","language":"C#","funding_links":["https://opencollective.com/nanoframework","https://github.com/sponsors/nanoframework"],"categories":[],"sub_categories":[],"readme":"﻿\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoFramework.Aws.IoTCore.Devices\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoFramework.Aws.IoTCore.Devices)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoFramework.Aws.IoTCore.Devices\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework.Aws.IoTCore.Devices)\n[![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Aws.IoTCore.Devices.svg?label=NuGet\u0026style=flat\u0026logo=nuget)](https://www.nuget.org/packages/nanoFramework.Aws.IoTCore.Devices/)\n[![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md)\n[![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord\u0026logoColor=white\u0026label=Discord\u0026color=7289DA)](https://discord.gg/gCyBu8T)\n\n![nanoFramework logo](https://raw.githubusercontent.com/nanoframework/Home/main/resources/logo/nanoFramework-repo-logo.png)\n\n-----\n\n# Welcome to the .NET **nanoFramework** Aws.IoTCore.Devices repository\n\n## Build status\n\n| Component | Build Status | NuGet Package |\n|:-|---|---|\n| nanoFramework.Aws.IoTCore.Devices | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Aws.IoTCore.Devices/_apis/build/status/Aws.IoTCore.Devices?repoName=nanoframework%2FnanoFramework.Aws.IoTCore.Devices\u0026branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Aws.IoTCore.Devices/_build/latest?definitionId=81\u0026repoName=nanoframework%2FnanoFramework.Aws.IoTCore.Devices\u0026branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Aws.IoTCore.Devices.svg?label=NuGet\u0026style=flat\u0026logo=nuget)](https://www.nuget.org/packages/nanoFramework.Aws.IoTCore.Devices/) |\n\n## See it in action\n\nTODO! Please help us to add some samples!\n\n## Usage\n\n**Important**: Due to TLS, You **must** be connected to the internet (which means already having an IP address from your router) **and** a valid (minimum of today) date and time. Please check the examples that use networking (especially those that include TLS/NTP) to help you ensure it will work.\n\nThis AWS IoT SDK is using MQTT. So you need to ensure you have an outbound firewall port open to the TCP port 8883. If you are in an enterprise network, this may be blocked.\n\nIf it is, in future, we plan to add WebSocket support.\n\nThe the name of the classes and the methods try to get close to the [.NET nanoFramework C# Azure IoT SDK](https://github.com/nanoFramework/nanoFramework.Azure.Devices). This should allow an easier portability of the code between both cloud provider environments.\n\n### Certificate\n\nYou have 2 options to provide the right Azure IoT TLS certificate:\n\n- Pass it in the constructor\n- Store it into the device\n\nThe [X.509Certificates](https://docs.aws.amazon.com/iot/latest/developerguide/x509-client-certs.html) contain, for your convenience, the default root certificate used to connect to AWS IoT.\n\n#### Thru the constructor\n\nYou will have to embed the certificate into your code, or add it as a resource:\n\n```csharp\nconst string AwsRootCA = @\"-----BEGIN CERTIFICATE-----\nMIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\nADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\nb24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\nMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\nb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj\nca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM\n9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw\nIFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6\nVOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L\n93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm\njgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\nAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA\nA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI\nU5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs\nN+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv\no/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\nrqXRfboQnoZsG4q5WTP468SQvvG5\n-----END CERTIFICATE-----\n\";\nMqttConnectionClient awsIoT = new MqttConnectionClient(IotBrokerAddress, ThingId, clientCert, MqttConnectionClient.QoSLevel.AtLeastOnce, awsRootCACert: new X509Certificate(AzureRootCA));\n```\n\nYou can place your binary certificate in the resources as well and just get the certificate from it:\n\n```csharp\nX509Certificate awsRootCACert = new X509Certificate(Resources.GetBytes(Resources.BinaryResources.AwsCAcertificate));\nMqttConnectionClient awsIoT = new MqttConnectionClient(IotBrokerAddress, ThingId, clientCert, MqttConnectionClient.QoSLevel.AtLeastOnce, awsRootCACert);\n```\n\nNote: when the certificate expires, you will have to fully reflash the device with the new certificates and keys, or build a mechanism into your code to include primary and secondary versions of them.\n\n#### Storing the certificate into the device\n\nYou can store the certificate in the device flash and not in the code, so if you have to change the certificate, you'll just have to clean the current store and upload the new one. Edit the network properties:\n\n![edit device network](https://raw.githubusercontent.com/nanoframework/nanoFramework.Aws.IoTCore.Devices/main/readme-assets/device-network.jpg)\n\nNavigate to the `General` tab:\n\n![device network certificate](https://raw.githubusercontent.com/nanoframework/nanoFramework.Aws.IoTCore.Devices/main/readme-assets/device-network-certificate.jpg)\n\nBrowse to choose your certificate, it can be in a binary (crt, der) or string form (pem, txt) and select ok. The certificate to connect will be selected automatically during the connection.\n\n### Creating an MqttConnectionClient\n\nYou can connect to AWS IoT Core using a certificate containing the private certificate and key, or IAM (not currently supported). The following example shows how to create it:\n\n```csharp\nconst string ThingId = \"nanoDeviceShadow\";\nconst string IotBrokerAddress = \"\u003caccount\u003e-ats.iot.\u003cregion\u003e.amazonaws.com\";\n//make sure to add a correct pfx certificate\nX509Certificate2 clientCert = new X509Certificate2(ClientRsaSha256Crt, ClientRsaKey, \"\");\nMqttConnectionClient awseIoT = new MqttConnectionClient(IotBrokerAddress, ThingId, clientCert, MqttConnectionClient.QoSLevel.AtLeastOnce, awsRootCACert);\n\n```\n\nNote: please see the previous section to understand how to better pass the certificate for your usage. The example shows the certificate uploaded into the device and not in the code.\n\n### Getting and updating Device Shadow\n\nYou can request your Shadow simply by calling the `GetShadow` function.\n\n```csharp\nvar shadow = awsIoT.GetShadow(new CancellationTokenSource(20000).Token);\nif (shadow == null)\n{\n    Debug.WriteLine($\"Can't get the shadow\");\n    awsIoT.Close();\n    return;\n}\n\nDebug.WriteLine($\"Shadow ClientToken: {shadow.DeviceId}, #desired: {shadow.status.desired}, #reported: {shadow.status.reported}\");\n```\n\nNote: it's important to use a `CancellationToken` that be cancelled after a certain amount of time. Otherwise, this will be blocking the thread up to the point the shadow will be received.\n\nShadows have status properties, reported and desired. They are a hashtable and you can get or try to get any element.\n\nYou can report your Shadow as simple as this:\n\nTODO: does not work yet!!!\n\n```csharp\nShadowCollection reported = new ShadowCollection();\nreported.Add(\"firmware\", \"myNano\");\nreported.Add(\"sdk\", 0.2);\nawsIoT.UpdateReportedProperties(reported);\n```\n\nYou also have the option to wait for the shadow update confirmation, in this case use a `CancellationToken` that can be cancelled. Otherwise the check will be ignored.\n\nNote: the function will return false if the shadow reception confirmation is not checked or if it did not arrive on time.\n\nYou can also register for any shadow update:\n\n```csharp\nawsIoT.ShadowUpated += ShadowUpdatedEvent;\n\nvoid ShadowUpdatedEvent(object sender, ShadowUpdateEventArgs e)\n{\n    Debug.WriteLine($\"Shadow update received:  {e.Shadow}\");\n}\n```\n\n### Sending message\n\nYou have to use the `SendMessage` function to send any kind of message or telemetry to AWS IoT. As with the other function, you have the possibility to ensure delivery using a `CancellationToken` than can be cancelled. If one that can't be cancelled is used, the delivery insurance will be ignored and the function will return false.\n\n```csharp\nvar isReceived = awsIoT.SendMessage($\"{{\\\"Temperature\\\":42,\\\"Pressure\\\":1024}}\", new CancellationTokenSource(5000).Token);\nDebug.WriteLine($\"Message received by IoT Core: {isReceived}\");\n```\n\nNote: The message will be send with the same quality of service you created the connection with. You won't get any answer for the quality 0. In this case, you can simplify it to:\n\n```csharp\nawsIoT.SendMessage($\"{{\\\"Temperature\\\":42,\\\"Pressure\\\":1024}}\");\n```\n\n### Cloud to device messages\n\nYou can register an event to receive Cloud to device messages:\n\nTODO: check works!!!\n\n```csharp\nawsIoT.CloudToDeviceMessage += CloudToDeviceMessageEvent;\n\n// The following example shows how to display all keys in debug\nvoid CloudToDeviceMessageEvent(object sender, CloudToDeviceMessageEventArgs e)\n{\n    Debug.WriteLine($\"Message arrived: {e.Message}\");\n    foreach (string key in e.Properties.Keys)\n    {\n        Debug.Write($\"  Key: {key} = \");\n        if (e.Properties[key] == null)\n        {\n            Debug.WriteLine(\"null\");\n        }\n        else\n        {\n            Debug.WriteLine((string)e.Properties[key]);\n        }\n    }\n\n    // e.Message contains the message itself\n    if(e.Message == \"stop\")\n    {\n        ShoudIStop = true;\n    }\n}\n```\n\nNote: the `sender` is a `MqttConnectionClient` class, you can then send a message back with a confirmation or any logic you've put in place.\n\n### Status update event\n\nA status update event is available:\n\n```csharp\nawsIoT.StatusUpdated += StatusUpdatedEvent;\n\nvoid StatusUpdatedEvent(object sender, StatusUpdatedEventArgs e)\n{\n    Debug.WriteLine($\"Status changed: {e.Status.State}, {e.Status.State}\");\n    // You may want to reconnect or use a similar retry mechanism\n    ////if (e.Status.State == Status.Disconnected)\n    ////{\n    ////    mqtt.Open();\n    ////}\n}\n```\n\nNote that they are status change based, so once the connect or disconnect event arrives, they'll be replaced by other events as soon as something else happened like receiving a shadow.\n\n## Future work items for discussion\n\n- Better documentation about ensuring \"persistent\" connections (or not) with documentation (including cloud policy doc for support)\n- Add some integration tests, including (scripts to auto provision cloud broker (and/or)) manual setup documents to ensure ease of use.-\n- Partial Greengrass support?!\n- Websocket support?!\n- fleet provisioning support?!\n\n## Feedback and documentation\n\nFor documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home).\n\nJoin our Discord community [here](https://discord.gg/gCyBu8T).\n\n## Credits\n\nThe list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/main/CONTRIBUTORS.md).\n\n## License\n\nThe .NET **nanoFramework** Class Libraries are licensed under the [MIT license](LICENSE.md).\n\n## Code of Conduct\n\nThis project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community.\nFor more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct).\n\n### .NET Foundation\n\nThis project is supported by the [.NET Foundation](https://dotnetfoundation.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoframework%2Fnanoframework.aws.iotcore.devices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoframework%2Fnanoframework.aws.iotcore.devices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoframework%2Fnanoframework.aws.iotcore.devices/lists"}