
{"id":16038,"date":"2023-06-27T06:17:33","date_gmt":"2023-06-27T06:17:33","guid":{"rendered":"https:\/\/rax-prod-wp-aws.com\/blogs\/getting-started-with-iot-on-aws\/"},"modified":"2026-11-04T15:23:05","modified_gmt":"2026-11-04T15:23:05","slug":"getting-started-with-iot-on-aws","status":"publish","type":"blogs","link":"https:\/\/www.rackspace.com\/en-gb\/blogs\/getting-started-with-iot-on-aws\/","title":{"rendered":"Getting Started with IoT on AWS"},"content":{"rendered":"<p>For some time now I have been wanting to get my hands on an IoT device and start playing around with them to understand how to integrate it with AWS IoT Core. I could have used AWS Greengrass for testing, but I preferred the novelty of using a physical board to carry out my tests.<\/p>\n<p>IoT boards are readily available online from a Raspberry Pi Zero to an ESP32, both of which are inexpensive. An online search will give you plenty of options to choose from. For this demo I will be using an ESP32 board.<\/p>\n<h2>Objective<\/h2>\n<p>For this demo I will be setting up my ESP32 to connect with AWS IoT Core, subscribe to a topic and then publish a message to that topic. I will set up the MQTT test client on AWS IoT Core to view the published messages.<\/p>\n<p>As a bonus, I will send a message back to the ESP32 by publishing a message from the AWS MQTT client.<\/p>\n<h3>Prerequisites<\/h3>\n<ul>\n<li>AWS account<\/li>\n<li>ESP32 board<\/li>\n<li>Arduino IDE which will be used to configure the ESP32 board&nbsp;<\/li>\n<\/ul>\n<h2>AWS IoT Core setup<\/h2>\n<p>We need to create a <em>Thing<\/em> in AWS IoT Core. In this case, the Thing will represent the ESP32 board.<\/p>\n<p>Once logged into your AWS console, go to the AWS IoT Core service page.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture1_3.png\" alt=\"AWS IoT Core service page\" \/><\/p>\n<p>In the IoT Core homepage, go to <em>Things<\/em> under Manage &gt; All devices then select <em>create things <\/em>on the top right-hand side of the page.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture2_1.png\" alt=\"The AWS IoT Core homepage\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We are going to create a single thing<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture3_1.png\" alt=\"Create Things Page on AWS IoT Core\" \/><\/p>\n<p>Give it a name and leave the rest as default<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture4_2.png\" alt=\"AWS IoT Core - Specify Thing Properties\" \/><\/p>\n<p>&nbsp;Autogenerate new certificates<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture5_1.png\" alt=\"AWS IoT Core- Auto Generation of New Certificates \" \/><\/p>\n<p>All IoT devices need to have a policy attached to it in order to perform its intended action. On the next page, we are going to create a new policy and then attach it to the device.<\/p>\n<p>In fact, the policy is attached to a certificate that we will be creating after this step.<\/p>\n<p>For this policy we need our ESP32 to be able to:<\/p>\n<ul>\n<li>&nbsp;iot:Connect<\/li>\n<li>&nbsp;iot:Subscribe<\/li>\n<li>&nbsp;iot:Receive<\/li>\n<li>&nbsp;iot:Publish<\/li>\n<\/ul>\n<p>In the <em>Create policy<\/em> page, give policy a name then select <em>JSON<\/em> from the <em>Policy document<\/em> section and replace the default document with the following:<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture6.PNG\" alt=\"AWS IoT Core - Code for Creating New Policy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture7.png\" alt=\"AWS IoT Core - Creating the Policy within AWS screen\" \/><\/p>\n<p>Save it and return to your IoT Core page where you should see the new policy you just created. If not, refresh the page.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture8.png\" alt=\"AWS IoT Core- Attaching Policies to Certificates \" \/><\/p>\n<p>Select create thing.<\/p>\n<p>You will be prompted to download certificates and keys. This is the only time you can download these. Make sure you download and keep them safe.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture9.png\" alt=\"AWS IoT Core - Download Certificates and Keys Prompt\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The policy you created earlier is now attached to this certificate.<\/p>\n<p>We have successfully created our thing. Now let\u2019s setup the ESP32 using the Arduino IDE.<\/p>\n<h2>Arduino Setup for ESP32<\/h2>\n<p>Before starting we need to setup a few things on our IDE. We need to download the MQTT library and ArduinoJSON library from the Arduino library manager. Choose the latest version for both the libraries.<\/p>\n<h3>App for ESP32<\/h3>\n<p>There are many simple demos you can find online to get started with programming ESP32 devices. For this demo we will be using the code provided here &#8211; &nbsp;<a href=\"https:\/\/github.com\/yash-sanghvi\/ESP32\/tree\/master\/AWS_IOT\">https:\/\/github.com\/yash-sanghvi\/ESP32\/tree\/master\/AWS_IOT<\/a><\/p>\n<h4>Configuration<\/h4>\n<p>We need to configure the ESP32 to connect to our WiFi and then connect to the AWS IoT Core using the certificates we downloaded earlier and our unique endpoint address which we will get later on.<\/p>\n<p>To start, lets create the file config.h in your Arduino IDE. Replace YOUR_THING_NAME, YOUR_SSID, YOUR_PASSWORD with your details.<\/p>\n<p>To get your unique endpoint address, you can run the following command if you have configured your AWS CLI:<\/p>\n<p>aws iot describe-endpoint &#8211;endpoint-type iot:Data-ATS<\/p>\n<p>Otherwise, you can go to the console to retrieve it<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture10.png\" alt=\"AWS IoT Core - Settings for getting unique endpoint\" \/><\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture11.PNG\" alt=\"AWS IoT Core - Sample Contents of Certificates\" \/><\/p>\n<p>Finally, copy and paste the contents of the certificates you downloaded earlier in the respected sections of the file.<\/p>\n<h3>What This App Does<\/h3>\n<p>A Quick description on what this app (<a href=\"https:\/\/github.com\/yash-sanghvi\/ESP32\/blob\/master\/AWS_IOT\/AWS_IOT.ino\" title=\"AWS_IOT.ino\">AWS_IOT.ino<\/a>) is going to do. It will establish a connection from your ESP32 with AWS IoT Core using the config.h configuration with the MQTT client.<\/p>\n<p>Once connected to the WiFi it will connect with the AWS IoT broker via the endpoint mentioned in your config.h file using the MQTT protocol. Once connected it will subscribe the esp32\/sub topic where we can later see the messages coming through in the console from the publishMessage() function every 4 seconds using loop() function.<\/p>\n<h3>Upload app<\/h3>\n<p>Verify and upload the app via the Arduino IDE.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture12.png\" alt=\"AWS IoT Core App Screen\" \/><\/p>\n<p>As soon as the upload is complete you should see lights flashing on your ESP32. This confirms that your device has connected to your WiFi and transmitting data.<\/p>\n<p>You can confirm this by viewing the serial monitor.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture13.png\" alt=\"AWS IoT Core App Serial Monitor Screen\" \/><\/p>\n<h3>Troubleshooting<\/h3>\n<p>ESP32 not connecting to IoT Core endpoint:<\/p>\n<ul>\n<li>In my experience this is usually due to a copy and paste error with the certificates or incorrect WiFi details.<\/li>\n<\/ul>\n<p>Arduino port not located once device connected:<\/p>\n<ul>\n<li>Usually due to the type of cable you are using, I got \u2018lucky\u2019 on the 4th cable not before trying to install different drivers. Nevertheless, ensure you do have the right UART driver for your ESP32. For reference, my one was a CP210x port.<\/li>\n<\/ul>\n<h3>Validate messages<\/h3>\n<p>To confirm we are receiving the messages, go to the MQTT test client within IoT Core console and subscribe to the topic our app created, esp32\/pub.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture14.png\" alt=\"AWS IoT Core - MQTT test client screen\" \/><\/p>\n<p>Hit subscribe and shortly after you should start seeing messages coming through<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture15.png\" alt=\"AWS IoT Core  - Successful Deployment of Messaging App\" \/><\/p>\n<p>This confirms our ESP32 has securely connected to IoT Core using the MQTT protocol and we are receiving messages.<\/p>\n<p>For one last test, let\u2019s try send a message back to our ESP32 and view the message in the serial monitor.<\/p>\n<p>In the MQTT test client, go to Publish to a topic and enter the topic name esp32\/sub<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture16.png\" alt=\"AWS IoT Core MQTT Test Client\" \/><\/p>\n<p>Once you hit publish, in your ESP32 serial monitor you should see the above payload message appear<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-body-Picture17.png\" alt=\"AWS IoT Core - Message Payload Appearing Successfully\" \/><\/p>\n<p>The receiving of this messages is made possible because of the mqtt_client.loop() function which is called within a loop to keep the connection alive between ESP32 and the AWS broker.<\/p>\n<h2>Conclusion<\/h2>\n<p>We have successfully programmed our ESP32 to send and receive messages to AWS IoT Core.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Getting Started with IoT on AWS<\/p>\n","protected":false},"author":2,"featured_media":16399,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","format":"standard","meta":{"content-type":"","nid":"25672","content_type":"blog","created_by":"10130","authored_on":"2023-06-26T11:47:33+05:30","field_article_industries":"","tag_category":"Technical","field_blog_author_text":"Nilojan Tharmarajah, Lead Cloud Practice Architect, Rackspace Technology","seo_description":"Learn how to create IoT apps using AWS IoT Core, the secure, scalable, and managed cloud service that makes connecting and deploying IoT devices easier.","field_featured_image":"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-insights_image-productivity-technical-blog-1-insights.jpg","insights_image":"\/wp-content\/uploads\/2026\/blog_technical_images\/25672-insights_image-productivity-technical-blog-1-insights.jpg","field_partners":"","rxt_platforms":"Amazon Web Services (AWS)","product":"","publisheddate":"2023-06-27T06:17:33","rxt_solutions":"","opengraph_tag":"","x_tag":"","teaser_flag":"Technical Blog","seo_titile":"How to Create an App Using AWS IoT Core | Rackspace Technology","field_topics":"","field_slug":"getting-started-with-iot-on-aws","footnotes":""},"categories":[],"tags":[204],"class_list":["post-16038","blogs","type-blogs","status-publish","format-standard","has-post-thumbnail","hentry","tag-technical"],"_links":{"self":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs\/16038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs"}],"about":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/types\/blogs"}],"author":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/comments?post=16038"}],"version-history":[{"count":2,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs\/16038\/revisions"}],"predecessor-version":[{"id":16041,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/blogs\/16038\/revisions\/16041"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/media\/16399"}],"wp:attachment":[{"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/media?parent=16038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/categories?post=16038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rackspace.com\/en-gb\/wp-json\/wp\/v2\/tags?post=16038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}