> ## Documentation Index
> Fetch the complete documentation index at: https://cloud-architect.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wokwi IoT Device Simulation with AWS IoT Core Real-Time Dashboard

> Hands-on lab · 45m

Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console.

<a className="ip-lab-portal-btn" href="https://labs.intellectualpoint.com/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard" target="_blank" rel="noreferrer">
  Open IP Lab Portal
</a>

## Overview

### Project Details

1. In this lab, we demonstrate how **AWS IoT Core** can seamlessly integrate with **AWS Lambda** to process IoT device messages in real time. You will simulate an IoT device using the **Wokwi ESP32 emulator**, connect it to **AWS IoT Core**, and send telemetry data that triggers a **Lambda function**. The processed data is then reflected on a **real-time dashboard hosted on an S3 static website**.
2. Duration: **2 hour**.
3. AWS Region: **US East (N. Virginia) us-east-1**.

### Prerequisites (in VS Code)

* Install the following extensions in Visual Studio Code:
* **Wokwi**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/001.gif?s=550cab1de0d49ac370676182f9c5bd17" alt="" width="839" height="354" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/001.gif" />

* **PlatformIO IDE**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/002.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=b8d25a3314b9e37e37d8c6a36cb9af27" alt="" width="1042" height="505" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/002.png" />

* **C/C++**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/003.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=59b573cd7f9d13d72f674c718780516a" alt="" width="1042" height="505" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/003.png" />

### Introduction

#### What is AWS IoT Core?

1. **AWS IoT Core** is a managed cloud service that enables connected devices to easily and securely interact with cloud applications and other devices
2. AWS IoT Core allows billions of devices to connect securely to the cloud, enabling communication between devices and cloud applications via standard protocols like MQTT, HTTP, and WebSockets
3. The service provides a message broker that routes messages between devices and applications, ensuring reliable communication. It supports one-to-one or one-to-many communications, allowing for complex interactions.
4. AWS IoT Core offers robust security features, including device authentication and authorization using X.509 certificates, AWS Identity and Access Management (IAM), and encryption of data in transit
5. AWS IoT Core integrates seamlessly with other AWS services, such as AWS Lambda, Amazon S3, and Amazon DynamoDB, enabling users to build scalable IoT applications that leverage the full AWS ecosystem.

#### Project Features:

* **Simulated IoT Device (Wokwi ESP32):**

  * Use Wokwi’s online emulator to simulate an ESP32-based IoT device without any physical hardware.
* **Secure Device Authentication:**

  * Attach AWS IoT Core certificates to enable secure MQTT communication.
* **AWS IoT Core Integration:**

  * Establish real-time MQTT communication between the device and AWS.
* **Lambda Function Trigger:**

  * Use an AWS IoT Rule to trigger a Lambda function on each device message.
* **Real-Time Web Dashboard:**

  * Host a live HTML dashboard on Amazon S3 with static website hosting.
* **IoT Core Test Client:**

  * Monitor messages sent by your IoT device directly within AWS.

#### Benefits:

* **No Hardware Required:**

  * Develop and test IoT applications entirely in the cloud using Wokwi.
* **Cost Efficiency:**

  * Pay only for Lambda executions; no need for always-on compute.
* **Hands-On with AWS Security:**

  * Learn how to manage device authentication with IoT certificates and policies.
* **Real-Time Processing:**

  * Process data instantly using AWS Lambda for analytics or actions.
* **Data Visualization:**

  * Build dashboards to visually monitor IoT metrics using static web hosting.
* **Scalable Architecture:**

  * Gain insight into a serverless, event-driven architecture suitable for production IoT solutions.

### Architecture Diagram

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/004.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=7fdd0f517c5eb7315587a7add36e557f" alt="" width="1189" height="528" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/004.png" />

### Task Details

1. Sign in to the AWS Management Console.
2. Create an IoT Policy.
3. Create an IoT Thing.
4. Activate the Wokwi license key in your browser.
5. Attach the AWS IoT certificates in the code.
6. Create a public S3 bucket.
7. Upload the HTML file and enable static website hosting.
8. Create a Lambda function.
9. Create an IoT Core rule.
10. Check IoT messages in the AWS IoT Core test client.
11. Run the wokwi code and check AWS IoT Core test client.
12. Check the live website and ensure data updates in real time.

### Launching Environment

1. To launch the lab environment, click on the **Start Project** button.
2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
3. Once the Project is started, you will be provided with **IAM username, Password, Access Key and Secret Access Key**.

> **Note:** You can only start one lab at any given time.

## Lab guide

### Lab Steps

#### Task 1: Sign in to AWS Management Console

1. Click on the **Open Console** button, and you will get redirected to AWS Console in a new browser tab.
2. On the AWS sign-in page,

   * Leave the **Account ID** as default. Never edit/remove the 12 digit Account ID present in the AWS Console. otherwise, you cannot proceed with the lab.
   * Now copy your **User Name** and **Password** in the lab Console to the **IAM Username and Password** in AWS Console and click on the **Sign in** button.
3. Once Signed In to the AWS Management Console, Make the default AWS Region as **US East (N. Virginia) us-east-1**.

#### Task 2: Create an IoT Policy

1. Make sure you are in the **US East (N. Virginia) us-east-1** Region.

2. Navigate to **IoT Core** by clicking on the Services menu in the top, then click on IoT Core.

3. From the left menu on Bedrock page click on **Policies** Under Security

4. On the Policy page click on **Create policy** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/005.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=ee334253e6af19e301e95327ac359424" alt="" width="1455" height="472" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/005.png" />

5. For policy name: Enter **whiz-policy**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/006.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=6184d592a8e76b3d15711f00d9908bd2" alt="" width="1600" height="379" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/006.png" />

6. For Policy Document Select JSON remove the existing and copy paste the below policy

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "*",
      "Resource": "*"
    }
  ]
}
```

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/007.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=a4f1b0390f5cb1329e9a30e370606913" alt="" width="1600" height="590" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/007.png" />

7. Click on **Create** button

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/008.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=6e00e4753c8d1f66bb4a0e4dc3cd90f3" alt="" width="1600" height="493" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/008.png" />

#### Task 3: Create an IoT Thing

1. On the left side menu Click on **Thing** under All devices.

2. Click on **Create things** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/009.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=c3e748bdfd18160120226ef620345252" alt="" width="1444" height="485" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/009.png" />

3. For Number of things to create: Select **Create single thing** and click on **Next** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/010.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=95cabb3c7315993e4bfca42419ac78b9" alt="" width="1600" height="667" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/010.png" />

4. For Thing name: Enter **whiz-thing**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/011.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=3a6d0f9f6799337eb101e3b0a97ea480" alt="" width="1582" height="952" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/011.png" />

5. Leave rest as default and click on **Next** button.

6. For Device Certifications leave it as default and click on **Next** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/012.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=d3563bb3fc8e31b04b5ad02e89e5d6b9" alt="" width="1598" height="924" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/012.png" />

7. For Attach Policies select whiz-policy created above and click on **Create thing** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/013.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=241c61c73393dca00aa5e7826f089ac2" alt="" width="1600" height="560" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/013.png" />

8. Download all the 5 certificates and keys in your local and click on Done.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/014.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=0b21ebc2bbafa325874014f0cd00084c" alt="" width="1186" height="1398" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/014.png" />

9. Once certificates get downloaded navigate to downloads folder to view downloaded files.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/015.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=06bcaa21647259123dad256b78a8bfd3" alt="" width="1426" height="430" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/015.png" />

10. Now first we will rename the files we will be using them later to configure authentication for the device

* Rename the certificate.pem.crt file to : **device.pem.crt**
* Rename the private.pem.key file to : **private.pem.key**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/016.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=8707befb5c8088c774d8da5255238f8e" alt="" width="1506" height="278" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/016.png" />

#### Task 4: Activate the Wokwi license key in your browser

1. Download the "[AWS\_IoT\_Core](https://labresources.whizlabs.com/d4af9350a40053467c4d40549623c9a7/aws_iot_core.zip)" file and extract it.

2. Navigate and Open the "**aws\_iot\_core**" folder.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/017.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=cb3a97ad4ab3a738f25af091a0e02b5b" alt="" width="528" height="376" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/017.png" />

3. Open the "**diagram.json**" file click "**Get your license key**" then click "**Open**".

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/018.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=876d818ceabba16a25fabb13e80d10c6" alt="" width="624" height="392" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/018.png" />

4. Click "**Get your license**" log in with your email or Gmail ID then click "**Get your license**" again.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/019.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=2145a2b0e6dd0f901a6e6fd67f73ac2f" alt="" width="1118" height="610" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/019.png" />

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/020.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=397e4f1adc4309d4c72d2fa3e23b7d17" alt="" width="919" height="531" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/020.png" />

5. Click **Get your license.**

6. Once the popup appears in your browser, click "**Open Visual Studio Code**" allow the **Wokwi Simulator** extension check the checkbox and click "**Open**".

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/021.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=57403b8174662e171b66c471e30581fa" alt="" width="1267" height="693" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/021.png" />

?7. If you get the following notification, click **Do not ask me again,** and Select **Open.**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/022.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=c8fd9d41881e4c4c93d47e8ff06de4e0" alt="" width="568" height="262" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/022.png" />

?

#### Task 5: Attach the AWS IoT certificates in the code

1. Navigate to **AWS iot core** service, then Click “**Connect one device**”

* Scroll down to find and copy the endpoint command, e.g.: **arti9nb0f3kjog-ats.iot.us-east-1.amazonaws.com**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/023.gif?s=a855c29adc9a610ec8da930bc1a27c66" alt="" width="1237" height="586" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/023.gif" />

* Open **VS Code**  aws\_iot\_core **src secrets.h**
* Replace the existing endpoint "aws\_end\_point" in the **secrets.h** file

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/024.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=b1c0f9737bff971fc1186648c8623f1b" alt="" width="1040" height="344" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/024.png" />

2. Copy and paste the certificates in “**secrets.h**” : Amazon Root CA1, Device Certificate, and Private Key in the respective place.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/025.gif?s=90289819ea370f70ac9f63322b8d6576" alt="" width="874" height="440" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/025.gif" />

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/026.gif?s=f7321d791666e99596bf53cdf52bb32f" alt="" width="950" height="616" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/026.gif" />

3.Now, Copy paste the **“device\_certificate”** and **“private.key**”

4.Open **main.cpp,** Click the tick button on the top right to compile

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/027.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=c98ef48b0c6b252ad796ed5fead4a81e" alt="" width="1433" height="772" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/027.png" />

#### Task 6: Create a public S3 bucket

In this task, we are going to create a new S3 bucket in the US East (N. Virginia) region with a unique name disabling ACLs, and allowing public access for hosting the static website.

1. Navigate to S3 by clicking on the **Services** menu at the top, then click on **S3** in the Storage section.

2. In the S3 dashboard, click on the **Create Bucket** button.

3. In the General Configuration,

* Select Bucket Type : **General purpose**
* Bucket name: Enter “**whizlabs-iot-dashboard**”

> **Note:** S3 bucket name is globally unique, choose a name that is available.

4. AWS Region: Select **US East (N. Virginia) us-east-1**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/028.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=3db5e467e7d4b63e93246eb6f2cdec51" alt="" width="1148" height="666" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/028.png" />

5. Object ownership: Select **ACLs disabled** (recommended) option

6. In the option of Block Public Access settings for this bucket, Uncheck the option of Block all public access.

* Check the I acknowledge that the current settings might result in this bucket and the objects within becoming public checkbox.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/029.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=0e5c4102d6d1b55e0fc790a2341de2ce" alt="" width="900" height="735" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/029.png" />

7. Keep everything default and click on **Create Bucket** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/030.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=3891f3676f56a239332ed3ac3b82f876" alt="" width="1014" height="253" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/030.png" />

#### Task 7: Upload the HTML file and Enable Static Website Hosting settings

In this task, we will enable static website hosting for our S3 bucket, configure it to use index.html and error.html, copy the provided endpoint, upload two files, and configure the bucket policy by copying its ARN and pasting the provided policy code.

1. To proceed, go to the S3 bucket name that you created and click on it. After that, navigate to the **Properties** tab which can be found at the top of the screen.

2. Scroll down to the Static website hosting section and click on **Edit** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/031.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=47cd584bd8afd19289b84abbd3abb3c3" alt="" width="1403" height="182" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/031.png" />

3.   In the Static website hosting dialog box

* Static website hosting: Select **Enable**
* Hosting type: Choose Host a static website
* Index document: Type **index.html**
* Error document: Type **error.html**
* Click on Save Changes.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/032.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=f93499350771bf3304d33e47f0201d4a" alt="" width="1000" height="730" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/032.png" />

4. Go to the **Properties** tab of your S3 bucket, and find the Static website hosting section. Copy the **Endpoint** provided in this section to your clipboard and save it for future reference.

5. The next step is to download the zip file by clicking on the replace the le [html\_file](https://labresources.whizlabs.com/d4af9350a40053467c4d40549623c9a7/html_file.zip), extract it, and upload two files named **index.html** and **error.html** to the S3 bucket you created earlier.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/033.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=c5f7d5133388e62a663ea800c0af8f04" alt="" width="1041" height="446" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/033.png" />

6. To configure your S3 bucket, access the Permissions tab and make the necessary configurations.

* In the Permissions tab, Click on the **Edit** button beside the Bucket Policy.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/034.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=e49d54b469557004f44dfc2dfb5b05be" alt="" width="1401" height="331" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/034.png" />

* You will be able to see a Blank policy editor.
* Before creating the policy, you will need to copy the ARN (Amazon Resource Name) of your bucket.
* Copy the ARN of your bucket to the clipboard. It is displayed at the top of the policy editor. it will look like **ARN:“arn:aws:s3:::your-bucket-name"**.
* In the policy below, Update the **bucket ARN** on the Resource key value and paste the below policy code in the editor.

```
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadForWebsite",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::replace-the-bucket-name/*"
    }
  ]
}
```

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/035.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=7425e982061e8220dfab0abbf13c89b0" alt="" width="593" height="282" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/035.png" />

> **Note :** Ignore if any error popped up.

7. Click on **Save** changes button.

#### Task 8: Create a Lambda Function

In this task, we are going to create a Lambda function which is used to process the device messages.

1. Navigate to the services menu at the top, then click on Lambda under the Compute section.

2. Click on the Create a function button.

* Choose: **Author from scratch**.
* Function name: Enter “**WhizFunction**”
* Runtime: Select **Python 3.13**
* Architecture : **x86\_64**
* Click “**Change default execution role**”  -> choose “**Use an existing role**”
* Select  “**Lambda\_role\_ xxx**”

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/036.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=14e98e8f1477fdfde4c920d2da849523" alt="" width="1117" height="652" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/036.png" />

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/037.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=38375f79abb24c952385875b3ed74bcb" alt="" width="1072" height="546" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/037.png" />

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/038.gif?s=412803dfb7aefd3320e303ff5f7bcdec" alt="" width="1280" height="574" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/038.gif" />

3. Leave other fields as default and click on **Create function button**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/039.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=126082a2f1339c43ed0e200275733544" alt="" width="1600" height="673" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/039.png" />

4. If you scroll down a little bit, you can see the Code source section.

5. Remove the existing code in AWS lambda **lambda\_function.py** Copy the below code and paste it into your lambda **lambda\_function.py** file.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/040.gif?s=0a3129cd2ecf8ce9bfd8bd5952807ae0" alt="" width="1280" height="577" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/040.gif" />

##### Code here:

```
import boto3
import json

s3 = boto3.client('s3')

bucket_name = 'bucket-name'  # replace with your actual bucket

def lambda_handler(event, context):
    print("Received from IoT:", event)

    sensor_data = {
        'timestamp': event['timestamp'],
        'humidity': event['humidity'],
        'temperature': event['temperature']
    }

    s3.put_object(
        Bucket=bucket_name,
        Key='latest-data.json',
        Body=json.dumps(sensor_data),
        ContentType='application/json'
    )

    return {"statusCode": 200}
```

6. Replace the bucket name.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/041.gif?s=b0c01ed442a756037b756ce153b36e27" alt="" width="1280" height="555" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/041.gif" />

7. Save the function by clicking on **Deploy** button.

#### Task 9: Create an IoT Core rule

In this task, we will create an AWS IoT rule which will call Lambda function to process the messages from the device to AWS IoT core.

1. Open the IoT Core console on the left side menu click on **Rules** under Message routing.

2. Click on **Create rule** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/042.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=ed98eaaaea1e3ede21736fcbb931043c" alt="" width="1459" height="464" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/042.png" />

3. For Rule name: Enter **whiz\_rule** and click on **Next** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/043.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=af88804f119684b7b475b5c95b54464b" alt="" width="1600" height="965" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/043.png" />

4. For the SQL Query Statement copy paste the below sql statement and click on **Next** button.

```
SELECT * FROM 'iot/whizlabs'
```

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/044.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=bad9ff578090fa79db8b8c524134e620" alt="" width="1464" height="668" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/044.png" />

5. Now to Attach rule actions search for Lambda and select Lambda action.

* For Lambda function: Select **WhizFunction**
* Lambda function version: Select **\$Latest**

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/045.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=d44999c06a00d35b7ab5ee336380ee04" alt="" width="1572" height="846" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/045.png" />

6. Review all the details and click on **Create** button.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/046.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=43c4e8b0ff82c57d7b3f729731dd10d3" alt="" width="1459" height="394" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/046.png" />

#### Task 10: Check IoT messages in the AWS IoT Core test client

In this task, we will test message sending and receiving using the MQTT client in the AWS IoT Core dashboard.

1. On the AWS **IoT Core** console, click on **MQTT test client** and Click on the **Subscribe** to a topic tab.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/047.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=be77ff44eb1b73a7c5d60d04cd863dac" alt="" width="1453" height="410" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/047.png" />

2. For topic filter : Enter **iot/whizlabs** and click on **Subscribe** button.

3. Scroll down to view the subscription.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/048.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=f361ab94e0927d992831dd6cba8ffa29" alt="" width="1307" height="661" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/048.png" />

4. Now, click on **Publish** to a topic tab.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/049.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=22c7bfadb19f1405259179cec60e9f37" alt="" width="1600" height="745" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/049.png" />

5. For Topic name: Select **iot/whizlabs**

6. For the the Message payload copy paste the below message and click on Publish button.

```
{
  "timestamp": "20260701",
  "humidity": 10,
  "temperature": 90
}
```

<img src="https://mintcdn.com/ip-cloud-architect-pathway/KWEuugF0hlbw45mg/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/050.png?fit=max&auto=format&n=KWEuugF0hlbw45mg&q=85&s=ee1c0627457920692b64d23bf31a1ef6" alt="" width="1250" height="559" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/050.png" />

7.  To verify the message, go to the “**Subscribe to a topic**” tab in the MQTT client dashboard.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/051.gif?s=76af6e4be3a13ca1488cc6bf56c77444" alt="" width="1280" height="578" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/051.gif" />

8. You will see the incoming messages displayed in real time as they are published.

#### Task 11: Run the wokwi code and check AWS IoT Core test client

1. Open the **aws\_iot\_core** folder, then navigate to the **src directory** and open the **main.cpp** file. Wait 2–3 minutes

2. To compile the code, click the checkmark button in the top right corner.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/052.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=88c06f2a4fa4de152ee50b7c5e0357c9" alt="" width="1433" height="772" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/052.png" />

3. Once the code compiles successfully, open the diagram.json file.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/053.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=76d23391985a2ba40b6d92267fb4dfad" alt="" width="1214" height="625" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/053.png" />

4. Click the “**Run**” button. Please wait 2–3 minutes, as it may take some time to connect to AWS IoT Core.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/054.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=165d2f0df5483eb46ba91345f786b925" alt="" width="1018" height="777" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/054.png" />

5. Once successfully connected, the device will start sending data in JSON format.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/055.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=0b806b0793ba5f593c134b2048360355" alt="" width="1193" height="793" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/055.png" />

6. To verify the data is being sent, go to the AWS IoT Core MQTT test client.

7. In the “**Subscribe to a topic**” tab, enter the topic used in your code (e.g., iot/whizlabs) and click Subscribe.

8. You will see the JSON-formatted messages appear in real time — this confirms successful data transmission from your device to AWS IoT Core.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/056.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=aacec5ea9f99f9d4968d753ac0b623ff" alt="" width="1131" height="672" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/056.png" />

#### Task 12: Check the live website and ensure data updates in real time

1. Go to the S3 bucket where your files are stored. Click on the **index.html** file to open its details.

2. Copy and click the “**Object URL**” from the file overview section — this is the public link to access the web page (if permissions allow).

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/057.gif?s=cdafc734261109e6d8850a4e0dc6b4d0" alt="" width="1280" height="559" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/057.gif" />

3. The index.html file will open as a webpage. You should now see your hosted web content rendered in the browser.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/058.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=172abafe189bc93487513553e28fbad1" alt="" width="1199" height="690" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/058.png" />

4. Click to change the value from the sensor . (vscode)

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/059.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=50ca045a59e76cd8c934cffff93f16a1" alt="" width="1155" height="746" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/059.png" />

5. The updated data will be sent through AWS IoT Core and you will see the values update live on the webpage.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/060.gif?s=e39d8cd65ee2d368ff2d707dd115e6a0" alt="" width="800" height="463" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/060.gif" />

6. If the data does not update on the webpage, try rerunning the Wokwi simulator. After restarting, wait for it to reconnect to AWS IoT Core, and the live data should begin updating again.

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/061.png?fit=max&auto=format&n=BYaaYIEpI79mJOeH&q=85&s=33879c20f1db7b86a35da52218aad3ad" alt="" width="1185" height="661" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/061.png" />

> ##### Do You Know?
>
> “ AWS IoT Core can handle billions of messages from millions of devices simultaneously — and route them to AWS services like Lambda, S3, DynamoDB, or even Machine Learning models in real time. It uses MQTT, HTTP, and WebSocket protocols, making it flexible for different types of IoT devices — from microcontrollers to complex edge systems. ”

[https://labresources.whizlabs.com/d4af9350a40053467c4d40549623c9a7/chrome-capture-2025-8-5\\\_37\\\_26.gif](https://labresources.whizlabs.com/d4af9350a40053467c4d40549623c9a7/chrome-capture-2025-8-5\\_37\\_26.gif)

<img src="https://mintcdn.com/ip-cloud-architect-pathway/BYaaYIEpI79mJOeH/images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/062.gif?s=7b63b70c0c34da1d6ffe7cc4a622dc15" alt="" width="1000" height="476" data-path="images/labs/wokwi-iot-device-simulation-with-aws-iot-core-real-time-dashboard/062.gif" />

### Completion and Conclusion

1. You have successfully created an IoT Policy
2. You have successfully created an IoT Thing
3. You have successfully created a Wokwi simulation dashboard using VS Code.
4. You have successfully created a Lambda Function.
5. You have successfully created an IoT Rule.
6. You have successfully created and launched an Amazon S3 bucket.
7. You have successfully configured the bucket to host a static website.
8. You have tested your static website to make sure it works correctly.

### End Lab

1. Sign out of AWS Account.
2. You have successfully completed the lab.
3. Once you completed the steps, click on **End Lab** from your IP Lab Portal and wait till the process gets completed.

## What gets checked

When you press **Check my work**, the platform verifies each of these:

* **Create an AWS Lambda Function** — Check whether a Lambda Function is created or not
* **Create IoT Core Rule** — Check whether an IoT Core Rule is created or not.
* **Create IoT Core Thing** — Check whether an IoT Core Thing is created or not.
* **Create IoT Core Policy** — Check whether an IoT Core Policy is created or not.
* **Create Public AWS S3 Bucket** — Check whether a Public S3 Bucket created or not

## Related help

* [FAQs and Troubleshooting](/aws-saa/support/faqs-and-troubleshooting)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.