Skip to content

Commit 131ce9b

Browse files
committed
revamp iot
1 parent 1dc9641 commit 131ce9b

File tree

1 file changed

+24
-23
lines changed
  • src/content/docs/aws/services

1 file changed

+24
-23
lines changed

src/content/docs/aws/services/iot.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
22
title: "IoT"
3-
linkTitle: "IoT"
43
tags: ["Base"]
5-
description: >
6-
Get started with AWS IoT on LocalStack
4+
description: Get started with AWS IoT on LocalStack
75
---
86

97
## Introduction
@@ -12,7 +10,7 @@ AWS IoT provides cloud services to manage IoT devices and integrate them with ot
1210

1311
LocalStack supports IoT Core, IoT Data, IoT Analytics.
1412
Common operations for creating and updating things, groups, policies, certificates and other entities are implemented with full CloudFormation support.
15-
The supported APIs are available on our [API coverage page]({{< ref "coverage_iot" >}}).
13+
The supported APIs are available on our [API coverage page]().
1614

1715
LocalStack ships a [Message Queuing Telemetry Transport (MQTT)](https://mqtt.org/) broker powered by [Eclipse Mosquitto](https://mosquitto.org/) which supports both pure MQTT and MQTT-over-WSS (WebSockets Secure) protocols.
1816

@@ -24,42 +22,45 @@ Start LocalStack using your preferred method.
2422

2523
To retrieve the MQTT endpoint, use the [`DescribeEndpoint`](https://docs.aws.amazon.com/iot/latest/apireference/API_DescribeEndpoint.html) operation.
2624

27-
{{< command >}}
28-
$ awslocal iot describe-endpoint
29-
<disable-copy>
25+
```bash
26+
awslocal iot describe-endpoint
27+
```
28+
29+
You can see an output similar to the following:
30+
31+
```bash
3032
{
3133
"endpointAddress": "000000000000.iot.eu-central-1.localhost.localstack.cloud:4510"
3234
}
33-
</disable-copy>
34-
{{< / command >}}
35+
```
3536

36-
{{< callout "tip" >}}
37+
:::note
3738
LocalStack lazy-loads services by default.
3839
The MQTT broker may not be automatically available on a fresh launch of LocalStack.
3940
You can make a `DescribeEndpoint` call to start the broker and identify the port.
40-
{{< /callout >}}
41+
:::
4142

4243
This endpoint can then be used with any MQTT client to publish and subscribe to topics.
4344
In this example, we will use the [Hive MQTT CLI](https://hivemq.github.io/mqtt-cli/docs/installation/).
4445

4546
Run the following command to subscribe to an MQTT topic.
4647

47-
{{< command >}}
48-
$ mqtt subscribe \
48+
```bash
49+
mqtt subscribe \
4950
--host 000000000000.iot.eu-central-1.localhost.localstack.cloud \
5051
--port 4510 \
5152
--topic climate
52-
{{< /command >}}
53+
```
5354

5455
In a separate terminal session, publish a message to this topic.
5556

56-
{{< command >}}
57-
$ mqtt publish \
57+
```bash
58+
mqtt publish \
5859
--host 000000000000.iot.eu-central-1.localhost.localstack.cloud \
5960
--port 4510 \
6061
--topic climate \
6162
-m "temperature=30°C;humidity=60%"
62-
{{< /command >}}
63+
```
6364

6465
This message will be pushed to all subscribers of this topic, including the one in the first terminal session.
6566

@@ -68,10 +69,10 @@ This message will be pushed to all subscribers of this topic, including the one
6869
LocalStack IoT maintains its own root certificate authority which is regenerated at every run.
6970
The root CA certificate can be retrieved from <http://localhost.localstack.cloud:4566/_aws/iot/LocalStackIoTRootCA.pem>.
7071

71-
{{< callout "tip" >}}
72+
:::note
7273
AWS provides its root CA certificate at <https://www.amazontrust.com/repository/AmazonRootCA1.pem>.
7374
[This section](https://docs.aws.amazon.com/iot/latest/developerguide/server-authentication.html#server-authentication-certs) contains information about CA certificates.
74-
{{< /callout >}}
75+
:::
7576

7677
When connecting to the endpoints, you will need to provide this root CA certificate for authentication.
7778
This is illustrated below with Python [AWS IoT SDK](https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html),
@@ -168,10 +169,10 @@ Currently the `principalIdentifier` and `sessionIdentifier` fields in event payl
168169

169170
LocalStack can publish the [registry events](https://docs.aws.amazon.com/iot/latest/developerguide/registry-events.html), if [you enable it](https://docs.aws.amazon.com/iot/latest/developerguide/iot-events.html#iot-events-enable).
170171

171-
{{< command >}}
172-
$ awslocal iot update-event-configurations \
173-
--event-configurations '{"THING":{"Enabled": true}}'
174-
{{< / command >}}
172+
```bash
173+
awslocal iot update-event-configurations \
174+
--event-configurations '{"THING":{"Enabled": true}}'
175+
```
175176

176177
You can then subscribe or use topic rules on the follow topics:
177178

0 commit comments

Comments
 (0)