Skip to content

Commit 4030c4e

Browse files
committed
Merge branch 'main' of https://github.com/aws/aws-iot-device-sdk-java-v2 into service_file_validation
2 parents 941ff25 + 020a802 commit 4030c4e

File tree

1 file changed

+60
-10
lines changed

1 file changed

+60
-10
lines changed

documents/FAQ.md

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
* [How do I get more information from an error code?](#how-do-i-get-more-information-from-an-error-code)
77
* [I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP](#i-keep-getting-aws_error_mqtt_unexpected_hangup)
88
* [I am experiencing deadlocks](#i-am-experiencing-deadlocks)
9-
* [How do debug in VSCode?](#how-do-debug-in-vscode)
9+
* [How to debug in VSCode?](#how-to-debug-in-vscode)
1010
* [What certificates do I need?](#what-certificates-do-i-need)
11+
* [I am getting AWS_IO_TLS_ERROR_DEFAULT_TRUST_STORE_NOT_FOUND](#root-ca-file)
1112
* [How do I build and use the Android SDK?](#how-do-i-build-and-use-the-android-sdk)
1213
* [Where can I find MQTT 311 Samples?](#where-can-i-find-mqtt-311-samples)
14+
* [How can I improve the library size?](#how-can-i-improve-the-library-size)
1315
* [I still have more questions about this sdk?](#i-still-have-more-questions-about-this-sdk)
1416

1517
### Where should I start?
@@ -28,14 +30,14 @@ To enable logging in the samples, you will need to set the following system prop
2830
```
2931

3032
* `aws.crt.debugnative`: Whether to debug native (C/C++) code. Can be either `true` or `false`.
31-
* `aws.crt.log.destination`: Where the logs are outputted to. Can be `File`, `Stdout` or `Stderr`. Defaults to `Stderr`.
33+
* `aws.crt.log.destination`: Where the logs are output to. Can be `File`, `Stdout`, or `Stderr`. Defaults to `Stderr`.
3234
* `aws.crt.log.level`: The level of logging shown. Can be `Trace`, `Debug`, `Info`, `Warn`, `Error`, `Fatal`, or `None`. Defaults to `Warn`.
3335
* `aws.crt.log.filename`: The path to save the log file. Only needed if `aws.crt.log.destination` is set to `File`.
3436

3537
For example, to run `Mqtt X509` with logging you could use the following:
3638

3739
```sh
38-
mvn compile exec:java -pl samples/Mqtt/Mqtt5X509 -Daws.crt.debugnative=true -Daws.crt.log.level=Debug -Daws.crt.log.destionation=Stdout -Dexec.args='--endpoint <endpoint> --cert <path to cert> --key <path to key>'
40+
mvn compile exec:java -pl samples/Mqtt/Mqtt5X509 -Daws.crt.debugnative=true -Daws.crt.log.level=Debug -Daws.crt.log.destination=Stdout -Dexec.args='--endpoint <endpoint> --cert <path to cert> --key <path to key>'
3941
```
4042

4143
You can also enable [CloudWatch logging](https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html) for IoT which will provide you with additional information that is not available on the client side sdk.
@@ -55,7 +57,7 @@ System.out.println(CRT.awsErrorString(errorCode));
5557

5658
### I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP
5759

58-
This could be many different things but it most likely is a policy issue. Start with using a super permissive IAM policy called AWSIOTFullAccess which looks like this:
60+
This could be many different things, but it is most likely a policy issue. Start by using a super permissive IAM policy called AWSIOTFullAccess which looks like this:
5961

6062
``` json
6163
{
@@ -78,9 +80,9 @@ After getting it working make sure to only allow the actions and resources that
7880

7981
You MUST NOT perform blocking operations on any callback, or you will cause a deadlock. For example: in the on_publish_received callback, do not send a publish, and then wait for the future to complete within the callback. The Client cannot do work until your callback returns, so the thread will be stuck.
8082

81-
### How do debug in VSCode?
83+
### How to debug in VSCode?
8284

83-
Here is an example launch.json file to run the pubsub sample
85+
Here is an example `launch.json` file to run the X509 sample
8486
``` json
8587
{
8688
// Use IntelliSense to learn about possible attributes.
@@ -95,6 +97,7 @@ Here is an example launch.json file to run the pubsub sample
9597
"mainClass": "mqtt5x509.Mqtt5X509",
9698
"projectName": "Mqtt5X509",
9799
"args": "--endpoint <account-number>-ats.iot.<region>.amazonaws.com --cert <path to cert> --key <path to key> --client-id test-client",
100+
"vmArgs": "-Daws.crt.debugnative=true -Daws.crt.log.destination=Stdout",
98101
"console": "externalTerminal"
99102
}
100103
]
@@ -106,23 +109,70 @@ Here is an example launch.json file to run the pubsub sample
106109
* You can download pre-generated certificates from the AWS console (this is the simplest and is recommended for testing)
107110
* You can also generate your own certificates to fit your specific use case. You can find documentation for that [here](https://docs.aws.amazon.com/iot/latest/developerguide/x509-client-certs.html) and [here](https://iot-device-management.workshop.aws/en/provisioning-options.html)
108111
* Certificates that you will need to run the samples
109-
* Root CA Certificates
110-
* Download the root CA certificate file that corresponds to the type of data endpoint and cipher suite you're using (You most likely want Amazon Root CA 1)
111-
* Generated and provided by Amazon. You can download it [here](https://www.amazontrust.com/repository/) or download it when getting the other certificates from the AWS console
112-
* When using samples it can look like this: `--ca_file root-CA.crt`
113112
* Device certificate
114113
* Intermediate device certificate that is used to generate the key below
115114
* When using samples it can look like this: `--cert abcde12345-certificate.pem.crt`
116115
* Key files
117116
* You should have generated/downloaded private and public keys that will be used to verify that communications are coming from you
118117
* When using samples you only need the private key and it will look like this: `--key abcde12345-private.pem.key`
119118

119+
### I am getting AWS_IO_TLS_ERROR_DEFAULT_TRUST_STORE_NOT_FOUND<a name="root-ca-file"></a>
120+
121+
This error usually occurs when the SDK cannot find or access the system's default trust store for TLS certificate validation. You can resolve this by downloading and specifying the Root CA certificate explicitly.
122+
123+
**Root CA Certificate**
124+
* Download the root CA certificate file that corresponds to the type of data endpoint and cipher suite you're using (you most likely want Amazon Root CA 1 if you are using the AWS IoT service)
125+
* This certificate is generated and provided by Amazon. You can download it [here](https://www.amazontrust.com/repository/) or download it when getting the other certificates from the AWS Console
126+
127+
**Set Root CA for the client builder**
128+
```java
129+
// When building your MQTT5 client, specify the CA file
130+
// Mqtt5ClientBuilder builder = <setup your client builder based on your auth type>
131+
builder.withCertificateAuthorityFromPath(null, "<path to AmazonRootCA1.pem>");
132+
```
133+
134+
120135
### How do I build and use the Android SDK?
121136
Instructions for building, installing, and use of the Android SDK can be found [here](../documents/ANDROID.md)
122137

123138
### Where can I find MQTT 311 Samples?
124139
The MQTT 311 Samples can be found in the v1.27.2 samples folder [here](https://github.com/aws/aws-iot-device-sdk-java-v2/tree/v1.27.2/samples)
125140

141+
### How can I improve the library size?
142+
143+
The SDK depends on aws-crt-java, which includes native binaries for multiple platforms (~50MB total). Here are two approaches to reduce size:
144+
145+
#### Option 1: Use Platform-Specific Dependencies
146+
147+
Use classifiers to include only your target platform's binaries:
148+
149+
```xml
150+
<dependency>
151+
<groupId>software.amazon.awssdk.crt</groupId>
152+
<artifactId>aws-crt</artifactId>
153+
<version>0.39.0</version>
154+
<classifier>linux-x86_64</classifier> <!-- Only Linux 64-bit -->
155+
</dependency>
156+
```
157+
158+
See [all available classifiers](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#available-classifiers).
159+
160+
#### Option 2: Build from Source
161+
162+
For maximum control, build both CRT and SDK locally:
163+
164+
1. [Build aws-crt-java from source](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#platform)
165+
2. Update `sdk/pom.xml` to use local aws-crt build:
166+
```xml
167+
<dependency>
168+
<groupId>software.amazon.awssdk.crt</groupId>
169+
<artifactId>aws-crt</artifactId>
170+
<version>1.0.0-SNAPSHOT</version>
171+
</dependency>
172+
```
173+
3. [Build the SDK from source](./DEVELOPING.md#building-from-source)
174+
175+
126176
### I still have more questions about this sdk?
127177

128178
* [Here](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) are the AWS IoT Core docs for more details about IoT Core

0 commit comments

Comments
 (0)