1
- ## AWS IoT SDK for Java v2
1
+ # AWS IoT SDK for Java v2
2
+ This document provides information about the AWS IoT device SDK for Java V2.
2
3
3
-
4
- Next generation AWS IoT Client SDK for Java using the AWS Common Runtime
5
-
6
- This project is in ** GENERAL AVAILABILITY** . If you have any issues or feature
7
- requests, please file an issue or pull request.
4
+ If you have any issues or feature requests, please file an issue or pull request.
8
5
9
6
This SDK is built on the AWS Common Runtime, a collection of libraries
10
7
([ aws-c-common] ( https://github.com/awslabs/aws-c-common ) ,
@@ -17,35 +14,36 @@ This SDK is built on the AWS Common Runtime, a collection of libraries
17
14
cross-platform, high-performance, secure, and reliable. The libraries are bound
18
15
to Java by the [ aws-crt-java] ( https://github.com/awslabs/aws-crt-java ) package.
19
16
20
- Integration with AWS IoT Services such as
21
- [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
22
- [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
23
- [ Fleet Provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
24
- is provided by code that been generated from a model of the service.
25
17
26
- # Installation
27
- ## Minimum Requirements
28
- * Java 8 or above
18
+ * __ Jump To:__ *
19
+ * [ Installation] ( #Installation )
20
+ * [ Samples] ( samples )
21
+ * [ Getting Help] ( #Getting-Help )
22
+ * [ Giving Feedback and Contributions] ( #Giving-Feedback-and-Contributions )
23
+ * [ More Resources] ( #More-Resources )
29
24
30
- ** Set JAVA_HOME first
31
25
32
- * Install Maven
33
26
34
- brew install maven
27
+ ## Installation
35
28
36
- ## Requirements to build the AWS CRT locally
29
+ ### Minimum Requirements
30
+ * Java 8 or above
31
+
32
+ ** Set JAVA_HOME first
33
+
34
+ ### Requirements to build the AWS CRT locally
37
35
* CMake 3.1+
38
36
* Clang 3.9+ or GCC 4.4+ or MSVC 2015+
39
37
40
- ## Build IoT Device SDK from source
38
+ ### Build IoT Device SDK from source
41
39
```
42
40
git clone https://github.com/awslabs/aws-iot-device-sdk-java-v2.git
43
41
# update the version of the CRT being used
44
42
mvn versions:use-latest-versions -Dincludes="software.amazon.awssdk.crt*"
45
43
mvn clean install
46
44
```
47
45
48
- ## Build CRT from source
46
+ ### Build CRT from source
49
47
``` sh
50
48
# NOTE: use the latest version of the CRT here
51
49
@@ -58,7 +56,7 @@ cd ../aws-iot-device-sdk-java-v2
58
56
mvn clean install
59
57
```
60
58
61
- ### Android
59
+ #### Android
62
60
Supports API 26 or newer.
63
61
NOTE: The shadow sample does not currently complete on android due to its dependence on stdin keyboard input.
64
62
``` sh
@@ -86,241 +84,50 @@ dependencies {
86
84
}
87
85
```
88
86
89
- # Samples
90
87
91
- ## Shadow
92
88
93
- This sample uses the AWS IoT
94
- [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
95
- Service to keep a property in
96
- sync between device and server. Imagine a light whose color may be changed
97
- through an app, or set by a local user.
89
+ ## Samples
98
90
99
- Once connected, type a value in the terminal and press Enter to update
100
- the property's "reported" value. The sample also responds when the "desired"
101
- value changes on the server. To observe this, edit the Shadow document in
102
- the AWS Console and set a new "desired" value.
91
+ [ Samples README] ( samples )
103
92
104
- On startup, the sample requests the shadow document to learn the property's
105
- initial state. The sample also subscribes to "delta" events from the server,
106
- which are sent when a property's "desired" value differs from its "reported"
107
- value. When the sample learns of a new desired value, that value is changed
108
- on the device and an update is sent to the server with the new "reported"
109
- value.
110
93
111
- Source: ` samples/Shadow `
112
94
113
- To Run:
114
- ```
115
- > mvn exec:java -pl samples/Shadow -Dexec.mainClass=shadow.ShadowSample -Dexec.args='--endpoint <endpoint> --rootca /path/to/AmazonRootCA1.pem --cert <cert path> --key <key path> --thingName <thing name>'
116
- ```
95
+ ## Getting Help
117
96
118
- Your Thing's
119
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
120
- must provide privileges for this sample to connect, subscribe, publish,
121
- and receive.
122
-
123
- <details >
124
- <summary >Sample Policy</summary >
125
- <pre >
126
- {
127
- "Version": "2012-10-17",
128
- "Statement": [
129
- {
130
- "Effect": "Allow",
131
- "Action": [
132
- "iot:Publish"
133
- ],
134
- "Resource": [
135
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get",
136
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update"
137
- ]
138
- },
139
- {
140
- "Effect": "Allow",
141
- "Action": [
142
- "iot:Receive"
143
- ],
144
- "Resource": [
145
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get/accepted",
146
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/get/rejected",
147
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/accepted",
148
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/rejected",
149
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/shadow/update/delta"
150
- ]
151
- },
152
- {
153
- "Effect": "Allow",
154
- "Action": [
155
- "iot:Subscribe"
156
- ],
157
- "Resource": [
158
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/get/accepted",
159
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/get/rejected",
160
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/accepted",
161
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/rejected",
162
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/shadow/update/delta"
163
- ]
164
- },
165
- {
166
- "Effect": "Allow",
167
- "Action": "iot:Connect",
168
- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
169
- }
170
- ]
171
- }
172
- </pre >
173
- </details >
97
+ Use the following sources for information :
174
98
175
- ## Jobs
99
+ * Check api and developer guides.
100
+ * Check for similar issues already opened.
176
101
177
- This sample uses the AWS IoT
178
- [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
179
- Service to describe jobs to execute.
102
+ If you still can’t find a solution to your problem open an [ issue] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues )
180
103
181
- This sample requires you to create jobs for your device to execute. See
182
- [ instructions here] ( https://docs.aws.amazon.com/iot/latest/developerguide/create-manage-jobs.html ) .
183
104
184
- On startup, the sample describes a job that is pending execution.
185
105
186
- Source: ` samples/Jobs `
106
+ ## Giving Feedback and Contributions
187
107
188
- To Run:
189
- ```
190
- > mvn exec:java -pl samples/Jobs -Dexec.mainClass=jobs.JobsSample -Dexec.args='--endpoint <endpoint> --rootca /path/to/AmazonRootCA1.pem --cert <cert path> --key <key path> --thingName <thing name>'
191
- ```
108
+ We need your help in making this SDK great. Please participate in the community and contribute to this effort by submitting issues, participating in discussion forums and submitting pull requests through the following channels.
192
109
193
- Your Thing's
194
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
195
- must provide privileges for this sample to connect, subscribe, publish,
196
- and receive.
197
-
198
- <details >
199
- <summary >Sample Policy</summary >
200
- <pre >
201
- {
202
- "Version": "2012-10-17",
203
- "Statement": [
204
- {
205
- "Effect": "Allow",
206
- "Action": [
207
- "iot:Publish"
208
- ],
209
- "Resource": [
210
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next",
211
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update"
212
- ]
213
- },
214
- {
215
- "Effect": "Allow",
216
- "Action": [
217
- "iot:Receive"
218
- ],
219
- "Resource": [
220
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/notify-next",
221
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next/accepted",
222
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/start-next/rejected",
223
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update/accepted",
224
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/things/<b >thingname</b >/jobs/*/update/rejected"
225
- ]
226
- },
227
- {
228
- "Effect": "Allow",
229
- "Action": [
230
- "iot:Subscribe"
231
- ],
232
- "Resource": [
233
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/notify-next",
234
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/start-next/accepted",
235
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/start-next/rejected",
236
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/*/update/accepted",
237
- "arn:aws:iot:<b >region</b >:<b >account</b >:topicfilter/$aws/things/<b >thingname</b >/jobs/*/update/rejected"
238
- ]
239
- },
240
- {
241
- "Effect": "Allow",
242
- "Action": "iot:Connect",
243
- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
244
- }
245
- ]
246
- }
247
- </pre >
248
- </details >
110
+ * [ Contributions Guidelines] ( master/CONTRIBUTING.md )
111
+ * Articulate your feature request or upvote existing ones on our [ Issues] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues?q=is%3Aissue+is%3Aopen+label%3Afeature-request ) page.
112
+ * Submit [ Issues] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues )
249
113
250
- ## fleet provisioning
251
114
252
- This sample uses the AWS IoT
253
- [ Fleet provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
254
- to provision devices using either a CSR or KeysAndcertificate and subsequently calls RegisterThing.
255
115
256
- On startup, the script subscribes to topics based on the request type of either CSR or Keys topics,
257
- publishes the request to corresponding topic and calls RegisterThing.
116
+ ## More Resources
258
117
259
- Source: ` samples/Identity `
118
+ * [ AWS IoT Core Documentation] ( https://docs.aws.amazon.com/iot/ )
119
+ * [ Developer Guide] ( https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html ) ([ source] ( https://github.com/awsdocs/aws-iot-docs ) )
120
+ * [ Issues] ( https://github.com/aws/aws-iot-device-sdk-java-v2/issues )
121
+ * [ Dev Blog] ( https://aws.amazon.com/blogs/?awsf.blog-master-iot=category-internet-of-things%23amazon-freertos%7Ccategory-internet-of-things%23aws-greengrass%7Ccategory-internet-of-things%23aws-iot-analytics%7Ccategory-internet-of-things%23aws-iot-button%7Ccategory-internet-of-things%23aws-iot-device-defender%7Ccategory-internet-of-things%23aws-iot-device-management%7Ccategory-internet-of-things%23aws-iot-platform )
260
122
261
- cd ~ /samples/Identity
262
-
263
- Run the sample using CreateKeysAndCertificate:
264
-
265
- ```
266
- mvn exec:java -Dexec.mainClass="identity.FleetProvisioningSample" -Dexec.args="--endpoint <endpoint> --rootca <root ca path>
267
- --cert <cert path> --key <private key path> --templateName <templatename> --templateParameters <templateParams>"
268
- ```
123
+ Integration with AWS IoT Services such as
124
+ [ Device Shadow] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html )
125
+ [ Jobs] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html )
126
+ [ Fleet Provisioning] ( https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html )
127
+ is provided by code that been generated from a model of the service.
269
128
270
- Run the sample using CreateCertificateFromCsr:
271
-
272
- ```
273
- mvn exec:java -Dexec.mainClass="identity.FleetProvisioningSample" -Dexec.args="--endpoint <endpoint> --rootca <root ca path>
274
- --cert <cert path> --key <private key path> --templateName <templatename> --templateParameters <templateParams> --csr <csr path>"
275
- ```
276
129
277
- Your Thing's
278
- [ Policy] ( https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html )
279
- must provide privileges for this sample to connect, subscribe, publish,
280
- and receive.
281
-
282
- <details >
283
- <summary >(see sample policy)</summary >
284
- <pre >
285
- {
286
- "Version": "2012-10-17",
287
- "Statement": [
288
- {
289
- "Effect": "Allow",
290
- "Action": [
291
- "iot:Publish"
292
- ],
293
- "Resource": [
294
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create/json",
295
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create-from-csr/json",
296
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/provisioning-templates/<b >templatename<b >/provision/json"
297
- ]
298
- },
299
- {
300
- "Effect": "Allow",
301
- "Action": [
302
- "iot:Receive",
303
- "iot:Subscribe"
304
- ],
305
- "Resource": [
306
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create/json/accepted",
307
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create/json/rejected",
308
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create-from-csr/json/accepted",
309
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/certificates/create-from-csr/json/rejected",
310
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/provisioning-templates/<b >templatename<b >/provision/json/accepted",
311
- "arn:aws:iot:<b >region</b >:<b >account</b >:topic/$aws/provisioning-templates/<b >templatename<b >/provision/json/rejected"
312
- ]
313
- },
314
- {
315
- "Effect": "Allow",
316
- "Action": "iot:Connect",
317
- "Resource": "arn:aws:iot:<b >region</b >:<b >account</b >:client/samples-client-id"
318
- }
319
- ]
320
- }
321
- </pre >
322
- </details >
323
130
324
131
# License
325
132
326
- This library is licensed under the Apache 2.0 License.
133
+ This library is licensed under the Apache 2.0 License.
0 commit comments