|
1 |
| -# Performing device management use cases using the AWS Iot SDK technical specification |
| 1 | +# AWS Iot SDK Basic Scenario Technical Specification |
2 | 2 |
|
3 | 3 | ## Overview
|
4 | 4 | This example shows how to use AWS SDKs to perform device management use cases using the AWS Iot SDK.
|
5 | 5 |
|
6 | 6 | The AWS Iot API provides secure, bi-directional communication between Internet-connected devices (such as sensors, actuators, embedded devices, or smart appliances) and the Amazon Web Services cloud. This example shows some typical use cases such as creating things, creating certifications, applying the certifications to the IoT Thing and so on.
|
7 | 7 |
|
8 |
| -The IotClient service client is used in this example and the following service operations are covered: |
9 |
| - |
10 |
| -1. Creates an AWS IoT Thing using the createThing(). |
11 |
| -2. Generate a device certificate using the createKeysAndCertificate(). |
12 |
| -3. Attach the certificate to the AWS IoT Thing using attachThingPrincipal(). |
13 |
| -4. Update an AWS IoT Thing with Attributes using updateThingShadow(). |
14 |
| -5. Get an AWS IoT Endpoint using describeEndpoint(). |
15 |
| -6. List your certificates using listCertificates(). |
16 |
| -7. Detach and delete the certificate from the AWS IoT thing. |
17 |
| -8. Updates the shadow for the specified thing. |
18 |
| -9. Write out the state information, in JSON format. |
19 |
| -10. Creates a rule |
20 |
| -11. List rules |
21 |
| -12. Search things |
22 |
| -13. Delete Thing. |
| 8 | +## Resources |
| 9 | +This program requires these AWS resources. |
| 10 | + |
| 11 | +1. **roleARN** - The ARN of an IAM role that has permission to work with AWS IOT. |
| 12 | +2. **snsAction** - An ARN of an SNS topic. |
| 13 | + |
| 14 | +## Hello AWS IoT |
| 15 | + |
| 16 | +This program is intended for users not familiar with the Amazon IoT SDK to easily get up and running. The logic is to show use of `listThingsPaginator`. |
| 17 | + |
| 18 | +## Scenario Program Flow |
| 19 | + |
| 20 | +This scenario demonstrates the following key AWS IoT Service operations: |
| 21 | + |
| 22 | +1. **Create an AWS IoT Thing**: |
| 23 | + - Use the `CreateThing` API to create a new AWS IoT Thing. |
| 24 | + - Specify the Thing name and any desired Thing attributes. |
| 25 | + |
| 26 | +2. **Generate a Device Certificate**: |
| 27 | + - Use the `CreateKeysAndCertificate` API to generate a new device certificate. |
| 28 | + - The certificate is used to authenticate the device when connecting to AWS IoT. |
| 29 | + |
| 30 | +3. **Attach the Certificate to the AWS IoT Thing**: |
| 31 | + - Use the `AttachThingPrincipal` API to associate the device certificate with the AWS IoT Thing. |
| 32 | + - This allows the device to authenticate and communicate with the AWS IoT Core service. |
| 33 | + |
| 34 | +4. **Update an AWS IoT Thing with Attributes**: |
| 35 | + - Use the `UpdateThingShadow` API to update the Thing's shadow with new attribute values. |
| 36 | + - The Thing's shadow represents the device's state and properties. |
| 37 | + |
| 38 | +5. **Get an AWS IoT Endpoint**: |
| 39 | + - Use the `DescribeEndpoint` API to retrieve the AWS IoT Core service endpoint. |
| 40 | + - The device uses this endpoint to connect and communicate with AWS IoT. |
| 41 | + |
| 42 | +6. **List Certificates**: |
| 43 | + - Use the `ListCertificates` API to retrieve a list of all certificates associated with the AWS IoT account. |
| 44 | + |
| 45 | +7. **Detach and Delete the Certificate**: |
| 46 | + - Use the `DetachThingPrincipal` API to detach the certificate from the AWS IoT Thing. |
| 47 | + - Use the `DeleteCertificate` API to delete the certificate. |
| 48 | + |
| 49 | +8. **Update the Thing Shadow**: |
| 50 | + - Use the `UpdateThingShadow` API to update the Thing's shadow with new state information. |
| 51 | + - The Thing's shadow represents the device's state and properties. |
| 52 | + |
| 53 | +9. **Write State Information in JSON Format**: |
| 54 | + - The state information is written in JSON format, which is the standard data format used by AWS IoT. |
| 55 | + |
| 56 | +10. **Create an AWS IoT Rule**: |
| 57 | + - Use the `CreateTopicRule` API to create a new AWS IoT Rule. |
| 58 | + - Rules allow you to define actions to be performed based on device data or events. |
| 59 | + |
| 60 | +11. **List AWS IoT Rules**: |
| 61 | + - Use the `ListTopicRules` API to retrieve a list of all AWS IoT Rules. |
| 62 | + |
| 63 | +12. **Search AWS IoT Things**: |
| 64 | + - Use the `SearchThings` API to search for AWS IoT Things based on various criteria, such as Thing name, attributes, or shadow state. |
| 65 | + |
| 66 | +13. **Delete an AWS IoT Thing**: |
| 67 | + - Use the `DeleteThing` API to delete an AWS IoT Thing. |
23 | 68 |
|
24 | 69 | Note: We have buy off on these operations from IoT SME.
|
25 | 70 |
|
26 |
| -### Application Output |
| 71 | +### Program execution |
27 | 72 |
|
28 |
| -This Workflow does have user interaction. The following shows the output of the Java V2 program. |
| 73 | +This scenario does have user interaction. The following shows the output of the program. |
29 | 74 |
|
30 | 75 | ```
|
31 | 76 | --------------------------------------------------------------------------------
|
@@ -55,23 +100,7 @@ Do you want to create a certificate for foo5543? (y/n)y
|
55 | 100 | Certificate:
|
56 | 101 | -----BEGIN CERTIFICATE-----
|
57 | 102 | MIIDWTCCAkGgAwIBAgIUY3PjIZIcFhCrPuBvH16219CPqD0wDQYJKoZIhvcNAQEL
|
58 |
| -BQAwTTFLMEkGA1UECwxCQW1hem9uIFdlYiBTZXJ2aWNlcyBPPUFtYXpvbi5jb20g |
59 |
| -SW5jLiBMPVNlYXR0bGUgU1Q9V2FzaGluZ3RvbiBDPVVTMB4XDTI0MDIwODE3MzQy |
60 |
| -M1oXDTQ5MTIzMTIzNTk1OVowHjEcMBoGA1UEAwwTQVdTIElvVCBDZXJ0aWZpY2F0 |
61 |
| -ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMGu1opgoPN1IgC1Zs07 |
62 |
| -CvOymzvn7oOrOAsElPOm632C0k35ah8ow55ABTtKNh2IvEB/mCDnwbEfqje7/Zuf |
63 |
| -gchh3NVZYrZNIVfCqjYellX7ZLQl0kfI1UMfCwzo49m/EJAHMdq9Mk1obDNVMg1X |
64 |
| -qgVOWEwYYHWPQrFWbaqo3M2tTv5Vi8poE31dLSQVdqwMQKqHLrI3o9YBxzHhXslf |
65 |
| -YHO8PNwT57JpXDWi2sFv9DF5eN+u6gJ6yK5NzijJbWgX0m7VGlBNdipuC+xKRLbZ |
66 |
| -+gAGXa8tcJCiDr5APooP0d5jmtBXfoIpFD829KUUBq7FT5gdSuKr4a2eLAEeCwlS |
67 |
| -4asCAwEAAaNgMF4wHwYDVR0jBBgwFoAUUn3bmDMoitplSl0rH3twQtv9qcYwHQYD |
68 |
| -VR0OBBYEFJn8RfLIEFDOOoAghWES4k4lgY2XMAwGA1UdEwEB/wQCMAAwDgYDVR0P |
69 |
| -AQH/BAQDAgeAMA0GCSqGSIb3DQEBCwUAA4IBAQCsZzp4jLP0KZXqk6/7uhchXpm/ |
70 |
| -3Z0bxzM4DaVHtNqM3QRO5deJ+Cfgw4CwuGZuCps0PdVj9zIyp8tmqQHskDYgjXOy |
71 |
| -wkBI+1KYNPJKul95HBK9abOAdXBEBQu87qKKT3UYCEqneOC0Z+FvUtdEHNrJYaxq |
72 |
| -DSotd4dqoUO1bx9V7ufAlLGmnODd3PRqCrVgOgqJUQK6mTOOzQd3lbTMwnCdj07C |
73 |
| -JZ3GSZrmxAnxVh2asjk1dAivb4PS4srIv1O2Fdwg+dfP/3OLm8hB3mTeyt4yk/8W |
74 |
| -ztv1nXA4Lkm9jPt7aea+0VY2MkIH4toJOZFo/yy8o3Gj2NEK6Mlb7ZpLvl2p |
| 103 | +BQAwTTFLMEkGA1UECwxCQW1hem9uIFdlYiBTZXJ2aWNlcy |
75 | 104 | -----END CERTIFICATE-----
|
76 | 105 |
|
77 | 106 |
|
@@ -169,5 +198,27 @@ Deleted Thing foo5543
|
169 | 198 | --------------------------------------------------------------------------------
|
170 | 199 | The AWS IoT workflow has successfully completed.
|
171 | 200 | --------------------------------------------------------------------------------
|
| 201 | +``` |
172 | 202 |
|
173 |
| -Process finished with exit code 0 |
| 203 | +## SOS Tags |
| 204 | + |
| 205 | +The following table describes the metadata used in this scenario. |
| 206 | + |
| 207 | + |
| 208 | +| action | metadata file | metadata key | |
| 209 | +|------------------------------|------------------------------|---------------------------------------- | |
| 210 | +| `describeEndpoint` | iot_metadata.yaml | iot_DescribeEndpoint | |
| 211 | +| `listThings` | iot_metadata.yaml | iot_ListThings | |
| 212 | +| `listCertificates` | iot_metadata.yaml | iot_ListCertificates | |
| 213 | +| `CreateKeysAndCertificate` | iot_metadata.yaml | iot_CreateKeysAndCertificate | |
| 214 | +| `deleteCertificate` | iot_metadata.yaml | iot_DeleteCertificate | |
| 215 | +| `searchIndex` | iot_metadata.yaml | iot_SearchIndex | |
| 216 | +| `deleteThing` | iot_metadata.yaml | iot_DeleteThing | |
| 217 | +| `describeThing` | iot_metadata.yaml | iot_DescribeThing | |
| 218 | +| `attachThingPrincipal` | iot_metadata.yaml | iot_AttachThingPrincipal | |
| 219 | +| `detachThingPrincipal` | iot_metadata.yaml | iot_DetachThingPrincipal | |
| 220 | +| `updateThing` | iot_metadata.yaml | iot_UpdateThing | |
| 221 | +| `createTopicRule` | iot_metadata.yaml | iot_CreateTopicRule | |
| 222 | +| `createThing` | iot_metadata.yaml | iot_CreateThing | |
| 223 | +| `hello ` | iot_metadata.yaml | iot_Hello | |
| 224 | +| `scenario | iot_metadata.yaml | iot_Scenario | |
0 commit comments