|
| 1 | +# AWS IoT code examples for the SDK for Kotlin |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Shows how to use the AWS SDK for Kotlin to work with AWS IoT. |
| 6 | + |
| 7 | +<!--custom.overview.start--> |
| 8 | +<!--custom.overview.end--> |
| 9 | + |
| 10 | +_AWS IoT provides secure, bi-directional communication for Internet-connected devices (such as sensors, actuators, embedded devices, wireless devices, and smart appliances) to connect to the AWS Cloud over MQTT, HTTPS, and LoRaWAN._ |
| 11 | + |
| 12 | +## ⚠ Important |
| 13 | + |
| 14 | +* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/). |
| 15 | +* Running the tests might result in charges to your AWS account. |
| 16 | +* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). |
| 17 | +* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). |
| 18 | + |
| 19 | +<!--custom.important.start--> |
| 20 | +<!--custom.important.end--> |
| 21 | + |
| 22 | +## Code examples |
| 23 | + |
| 24 | +### Prerequisites |
| 25 | + |
| 26 | +For prerequisites, see the [README](../../README.md#Prerequisites) in the `kotlin` folder. |
| 27 | + |
| 28 | + |
| 29 | +<!--custom.prerequisites.start--> |
| 30 | +<!--custom.prerequisites.end--> |
| 31 | + |
| 32 | +### Get started |
| 33 | + |
| 34 | +- [Hello AWS IoT](src/main/kotlin/com/example/iot/HelloIoT.kt#L6) (`listThings`) |
| 35 | + |
| 36 | + |
| 37 | +### Basics |
| 38 | + |
| 39 | +Code examples that show you how to perform the essential operations within a service. |
| 40 | + |
| 41 | +- [Learn the basics](src/main/kotlin/com/example/iot/IotScenario.kt) |
| 42 | + |
| 43 | + |
| 44 | +### Single actions |
| 45 | + |
| 46 | +Code excerpts that show you how to call individual service functions. |
| 47 | + |
| 48 | +- [AttachThingPrincipal](src/main/kotlin/com/example/iot/IotScenario.kt#L476) |
| 49 | +- [CreateKeysAndCertificate](src/main/kotlin/com/example/iot/IotScenario.kt#L511) |
| 50 | +- [CreateThing](src/main/kotlin/com/example/iot/IotScenario.kt#L528) |
| 51 | +- [CreateTopicRule](src/main/kotlin/com/example/iot/IotScenario.kt#L331) |
| 52 | +- [DeleteCertificate](src/main/kotlin/com/example/iot/IotScenario.kt#L257) |
| 53 | +- [DeleteThing](src/main/kotlin/com/example/iot/IotScenario.kt#L243) |
| 54 | +- [DescribeEndpoint](src/main/kotlin/com/example/iot/IotScenario.kt#L397) |
| 55 | +- [DescribeThing](src/main/kotlin/com/example/iot/IotScenario.kt#L494) |
| 56 | +- [DetachThingPrincipal](src/main/kotlin/com/example/iot/IotScenario.kt#L277) |
| 57 | +- [ListCertificates](src/main/kotlin/com/example/iot/IotScenario.kt#L384) |
| 58 | +- [SearchIndex](src/main/kotlin/com/example/iot/IotScenario.kt#L295) |
| 59 | +- [UpdateThing](src/main/kotlin/com/example/iot/IotScenario.kt#L429) |
| 60 | + |
| 61 | + |
| 62 | +<!--custom.examples.start--> |
| 63 | +<!--custom.examples.end--> |
| 64 | + |
| 65 | +## Run the examples |
| 66 | + |
| 67 | +### Instructions |
| 68 | + |
| 69 | + |
| 70 | +<!--custom.instructions.start--> |
| 71 | +<!--custom.instructions.end--> |
| 72 | + |
| 73 | +#### Hello AWS IoT |
| 74 | + |
| 75 | +This example shows you how to get started using AWS IoT. |
| 76 | + |
| 77 | + |
| 78 | +#### Learn the basics |
| 79 | + |
| 80 | +This example shows you how to do the following: |
| 81 | + |
| 82 | +- Create an AWS IoT Thing. |
| 83 | +- Generate a device certificate. |
| 84 | +- Update an AWS IoT Thing with Attributes. |
| 85 | +- Return a unique endpoint. |
| 86 | +- List your AWS IoT certificates. |
| 87 | +- Create an AWS IoT shadow. |
| 88 | +- Write out state information. |
| 89 | +- Creates a rule. |
| 90 | +- List your rules. |
| 91 | +- Search things using the Thing name. |
| 92 | +- Delete an AWS IoT Thing. |
| 93 | + |
| 94 | +<!--custom.basic_prereqs.iot_Scenario.start--> |
| 95 | +<!--custom.basic_prereqs.iot_Scenario.end--> |
| 96 | + |
| 97 | + |
| 98 | +<!--custom.basics.iot_Scenario.start--> |
| 99 | +<!--custom.basics.iot_Scenario.end--> |
| 100 | + |
| 101 | + |
| 102 | +### Tests |
| 103 | + |
| 104 | +⚠ Running tests might result in charges to your AWS account. |
| 105 | + |
| 106 | + |
| 107 | +To find instructions for running these tests, see the [README](../../README.md#Tests) |
| 108 | +in the `kotlin` folder. |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | +<!--custom.tests.start--> |
| 113 | +<!--custom.tests.end--> |
| 114 | + |
| 115 | +## Additional resources |
| 116 | + |
| 117 | +- [AWS IoT Developer Guide](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) |
| 118 | +- [AWS IoT API Reference](https://docs.aws.amazon.com/iot/latest/apireference/Welcome.html) |
| 119 | +- [SDK for Kotlin AWS IoT reference](https://sdk.amazonaws.com/kotlin/api/latest/iot/index.html) |
| 120 | + |
| 121 | +<!--custom.resources.start--> |
| 122 | +<!--custom.resources.end--> |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 127 | + |
| 128 | +SPDX-License-Identifier: Apache-2.0 |
0 commit comments