awsiot | ESP8266 / ESP32 examples with Amazon AWS IoT
kandi X-RAY | awsiot Summary
kandi X-RAY | awsiot Summary
ESP8266 / ESP32 examples with Amazon IoT.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of awsiot
awsiot Key Features
awsiot Examples and Code Snippets
Community Discussions
Trending Discussions on awsiot
QUESTION
We need to use a custom IoT endpoint due to firewall restrictions and needing to utilize Static Ips. We followed this AWS doc to get our endpoint with static Ips.. From here we are attempting to call the CreateKeysAndCertificate via Java. Now when we call IoT with our custom domain name, iot.custom.domain.name.com, with the regular Java SDK it works fine. However, whenever we try to use the Android SDK and call setEndpoint
with our custom domain we get the following error
ANSWER
Answered 2022-Mar-23 at 06:11When using the Android SDK for establishing IOT connections, the CreateKeysAndCertificateRequest
API is available through the AWSIotClient
class. If you are using the AWSIotClient
for creating new certs/keys, the SDK places this request on the generic iot..amazonaws.com
endpoint. The setEndpoint
method just allows you to change the region. This is because the request goes to the Control plane, whereas the endpoint that you have created would mostly likely be on the Data plane. There is no way around to create new certs/keys using the AWSIotClient
on the custom endpoint.
There is an alternate option that you can make use of. Almost all "requests" that you place on the IOT endpoint are messages that are published to "reserved topics". If you open up the Java SDK's PublishCreateKeysAndCertificate
API, you will see that it is ultimately publishing a message over a reserved topic. You can do something similar on Android using the Android SDK as well.
First, you will have to establish an authenticated connection. We cannot use CognitoCredentialsProvider
because of that auth request going to the Control Plane. Instead, you can use the provisioning certificates for the first time authentication. This is through provision certificates generated for a Provisioning Fleet. You can create a Provisioning Fleet and use those certificates in your device's keystore (or, a PKCS12 cert file). Using that, you can create a new awsIotMqttManager
object and publish a message on the reserved topic meant for creating new certs/keys. You can also subscribe to reserved topics meant for receiving the "accepted"/"rejected" responses for this request.
TL;DR
- Create an
awsIotMqttManager
using the provision certs - Subscribe to topic for listening for accepted/rejected response for
CreateKeysAndCertificates
request - Publish a message over the reserved topic meant for
CreateKeysAndCertificates
- Register the thing using the ownershipToken received in the response
- Store the new certs and use them for all future connections (make sure the policy attached to the certs have the necessary permissions)
QUESTION
In a python application that uses the aws iot device sdk for python v2 (v1.7.1) I am running into an issue where I cannot update the device shadow.
After starting the program, the DeviceShadowManager
will attempt to get the latest shadow state and set it locally.
If a delta
state is present the DeviceShadowManager
will merge the last reported
state and delta
state and publish it.
That works. However, when the manager subscribes for updates, after the initial setup, I am running into an error,
where when the desired
state changes, the manager cannot update the reported
state. Here is the error:
ANSWER
Answered 2021-Oct-25 at 09:24I am pretty sure the problem lies within
QUESTION
I am unable to successfully connect to an AWS IoT device via MQTT using websockets with authenticated cognito users. I am using aws-iot-device-sdk in a react application. Upon trying to connect, the following debug logs get printed to the web browser console:
...ANSWER
Answered 2021-Jun-21 at 20:20Resolved this problem.
In case anyone else was having this issues: the problem I was having was the Cognito User did not have a necessary certificate associated with it in order to access the resource.
QUESTION
I'm trying to build a React phone app that connects to AWS once it starts up. The first time I ran the app using Expo I got an error about missing the module "Util," so I followed this separate thread to resolve that issue. Afterwards, I got another issue regarding "filesys.existsSync is not a function," so I followed this other thread to resolve that issue.
When I followed the second thread, I connected the client through a websocket protocol rather than using a certificate. After making these changes, I tested to see if the connection worked in a node.js file, and it connected without any issues. I can also confirm that the React app runs without error on Expo without the AWS code. However, as soon as I try to combine the two, I get the following error.
In Expo, I get the following error logging:
...ANSWER
Answered 2021-Mar-23 at 02:36After messing around with things for a while, I managed to figure out the issue. For whatever reason, expo/React did not like the import import Aws from 'aws-sdk/dist/aws-sdk-react-native';
, so I instead changed it to import Aws from 'aws-sdk'
. Even with the changed import, I could still call Aws.config
, so nothing needed to change drastically with the code. I also moved the following codeblock into the IoTConnect
function:
QUESTION
I'm following the example pub/sub in awsiotsdk
.
ANSWER
Answered 2021-Jan-22 at 22:44EXACTLY_ONCE
(MQTT QOS level 2) is not currently supported by the AWS IoT Core server. This is mentioned in the source:
QUESTION
when I subscribe dynamic topic for connecting shadow. I m not able to establish connect the device. with out subscribe it's connected but not able to receive message payload.
Code
...ANSWER
Answered 2020-Dec-04 at 01:24yes you can't able to subscribe dynamic topic you have to change the policy "arn:aws:iot:ap-south-1:453533943651:topic/${iot:Connection.Thing.ThingName}/*" to *..for allow all device.then you can subscribe.topic/${iot:Connection.Thing.ThingName} this denotes the thingname should be come end of the topic. change to allow all you will able to subscribe.
QUESTION
ANSWER
Answered 2020-Oct-17 at 13:26I am posting the correct final version of my code in case anyone is facing similar issue. Three things were wrong in my original code.
- X_AMZ_DATE (YYYYMMDDTHHMMSSZ) didn't use it in HEADERS and STRING_TO_SIGN. Hence, was getting
Signature expired
error. - SERVICE I thought would be iot but it is iotdata.
Credential should be scoped to correct service
error was resolved. - CANONICAL_URI should only contain part after the domain and before query parameters. Eg. If request URI is
https://foo.bar.baz.com/foo1/foo2/foo3?bar1=baz1&bar2=baz2
then CANONICAL_URI ="/foo1/foo2/foo3"
QUESTION
To send telemetry from a thing
(say Sensor1) to AWS IoT Core endpoint, we need:
- AWS IoT Certificate Authority Public Certificate
- Certificate with appropriate policy and Sensor1 attached
- Private key of certificate from point 2
ANSWER
Answered 2020-Oct-03 at 06:57The certificates and private key are used to resolve three questions:
- As a client, am I talking to the real AWS IoT server and not an imposter?
- As the AWS IoT server, am I talking to a registered client and not an imposter?
- Can the client and server communicate securely without someone listening in?
The certificates and private key are used to implement mutual TLS to resolve these questions. This allows the client to authenticate the AWS IoT server (question 1) as well as the server to authenticate the client (question 2). The certificates also enable a secure TLS communication channel between the client and server (problem 3)
For the client authenticating the AWS IoT server (from https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html):
When your device or other client attempts to connect to AWS IoT Core, the AWS IoT Core server will send an X.509 certificate that your device uses to authenticate the server. Authentication takes place at the TLS layer through validation of the X.509 certificate chain This is the same method used by your browser when you visit an HTTPS URL.
The client uses the certificate referenced by the caPath
to validate the certificate that it receives from the server that it connects to.
For the AWS IoT server to authenticate the client (from https://docs.aws.amazon.com/iot/latest/developerguide/x509-client-certs.html#x509-client-cert-basics):
AWS IoT authenticates client certificates using the TLS protocol's client authentication mode.
In TLS client authentication, AWS IoT requests an X.509 client certificate and validates the certificate's status and AWS account against a registry of certificates. It then challenges the client for proof of ownership of the private key that corresponds to the public key contained in the certificate.
The server authenticates the client by receiving the registered certificate referenced by certPath
and by the client using the private key referenced by keyPath
to sign a message that proves that the client holds the private key.
QUESTION
I've provisioned a device in AWS with device Certificate which is signed by my CA. Also, I've registered my CA along with verificationCert in AWS previously.
Now when I send the data, In the options,
...ANSWER
Answered 2020-Apr-11 at 20:16The doc implies you should be passing paths to the files for the TLS certificate's and key.
e.g.
QUESTION
I have a mosquitto MQTT on a local raspberry pi working like a charm. I created a MQTT broker on AWS IoT that works as well.
On my raspberry pi I can connect, publish and subscribe on the AWS broker "manually", using the commands mosquitto_pub and mosquitto_sub. When I do this manually, i use all the certificates and stuff. The command I use is:
...ANSWER
Answered 2020-Mar-20 at 02:16Ok, I have no idea of what I did, I just know it fixed the problem.
At first I did a clean install of mosquitto on a Ubuntu VM I have and everything worked correctly.
Then I uninstalled Mosquitto from my raspberry pi and installed it again. Configured it just the way I configured the Ubuntu VM and still no luck. I started to think the problem was my raspbian image... but after fiddling a little bit on the configurations, moving the certificates files from one directory to another, changing their permissions, changing the bridge.conf file directory and stuff... It started working and now it's ok.
So if youre having this problem in the future: maybe is just the permissions of the files or directories.
EDIT (one day later): as I tried to replicate the same thing on another broker, I did everything the same but as soon as my local broker stablished the connection with AWS IoT bridge the connection was lost (message below. No certificate error this time):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install awsiot
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page