How to Expose Local IoT Services on AWS IoT Using Tunnelmole

Developing for the Internet of Things (IoT) often requires connecting devices located on local networks to the public internet. While AWS IoT offers a robust platform for efficiently managing and securely connecting these devices, a frequent challenge arises when needing to expose a local service—such as a web server or an API—to the public internet. This accessibility is essential for various tasks like testing webhook integrations, remotely controlling a web-based dashboard, and efficiently collaborating by sharing your work with colleagues or partners.

Traditionally, obtaining public access for a device on a local network involves configuring complex network settings, such as setting up port forwarding on the router, managing dynamic DNS, or implementing a reverse proxy server. These processes can be time-consuming, complex to set up, and potentially insecure if not implemented correctly. They are also often impractical or not feasible in environments with strict network administration, such as behind carriers’ CGNAT or restrictive corporate firewalls.

This is where Tunnelmole comes into play. Tunnelmole is an open-source tunneling tool that simplifies the process of creating a secure tunnel from a local machine to the public internet. This process provides a stable HTTPS URL within seconds, bypassing the more cumbersome network configurations required by traditional methods. Tunnelmole’s ease of use makes the process instantaneous, enhancing your productivity while maintaining the secure environment necessary for protecting your IoT services.

This article will guide you through leveraging Tunnelmole to provide a public URL for a simple web service running on a device managed by AWS IoT.

What is AWS IoT?

AWS IoT Core is a managed cloud service offered by Amazon Web Services that enables secure and straightforward interaction between connected devices and cloud-based applications and other devices. AWS IoT Core acts as a central message broker and hub, simplifying the process of connecting billions of IoT devices and managing trillions of messages to AWS services. This service eliminates the need to manage the underlying infrastructure for scaling your IoT applications, which can save time and resources.

AWS IoT is a versatile solution used by developers for various applications, including smart homes, industrial IoT (IIoT), connected vehicles, and healthcare monitoring. A typical setup consists of a lightweight client, such as an MQTT client, on the IoT device, which communicates securely with the AWS IoT Core endpoints. AWS IoT Core is optimized for sending small, infrequent messages; however, scenarios may arise where an application requires running a full-featured HTTP server directly on the IoT device.

Why Do You Need a Public URL For Your AWS IoT Device?

AWS IoT Core handles device-to-cloud communication exceptionally well, but having a direct public URL for your IoT device proves invaluable in various scenarios:

Testing Webhooks: If your IoT application needs to receive data from third-party services such as Stripe, Twilio, or IFTTT, a public webhook URL is essential. These external services cannot reach devices running on localhost (the local machine).
Remote Dashboards: A web-based dashboard on your IoT device could display sensor data or control actuators. A public URL enables access to this dashboard from anywhere globally, using any device, without requiring the user to be on the same local Wi-Fi network.
API Development and Testing: If your IoT device hosts a REST or GraphQL API, making it accessible via a public URL allows front-end developers or mobile app integrations, making it easier to test and develop these services without deploying the API to a staging environment.
Demos and Collaboration: Sharing your project via a stable public URL makes it more straightforward to provide a demonstration to clients, partners, or your team. This visibility can save considerable time and effort in keeping stakeholders informed and engaged with your IoT development projects.

Setting up Tunnelmole

Setting up Tunnelmole on your AWS IoT device requires just a few easy steps. First, download the Tunnelmole package for your operating system from its GitHub repository. After downloading and unzipping the package, run the Tunnelmole executable.

Upon the first run, Tunnelmole prompts you to confirm your email address for registration. This step assigns a unique subdomain to you, which will act as a prefix for all the URLs associated with the tunnels that you create.

Once registered, Tunnelmole displays a command-line interface, providing a list of options and commands that demonstrate its various features. The first command you should use is

mole –port=8080

Replace 8080 with the port on your IoT device where your web service, API, or dashboard is running.

Following this command execution, Tunnelmole automatically launches the tunnel and assigns a public HTTPS URL to your web service. This URL follows the pattern https://.tunnelmole.net.

Benefits and Use Cases

The capabilities offered by Tunnelmole provide significant value to IoT developers:

Security: The HTTPS protocol encrypts all of the data transmitted through the tunnel, which enhances security while protecting the sensitive data on the device and the information traversing the network.
Simplicity: Setting up a tunnel using Tunnelmole eliminates the need for complicated port forwarding or DNS configuration, saving valuable time and reducing configuration errors.
Stability: Tunnelmole maintains a dedicated server pool that consistently offers high uptime, ensuring the availability and stability of the public URL.
Customization: Multiple tunneling options are available, including custom domain mapping, which provides greater flexibility and control.

The combination of Tunnelmole’s ease of use and security makes it the ideal tool for exposing your AWS IoT-managed device to the public internet, enabling you to focus more on developing and refining your IoT solutions.

Conclusion

AWS IoT greatly simplifies IoT device management, and with the help of Tunnelmole, exposing them to the public internet can be done securely, quickly, and easily. Tunnelmole’s capabilities enable you to test webhooks, access remote dashboards, develop and test APIs, collaborate, and demonstrate your IoT projects effectively. By integrating AWS IoT and Tunnelmole, you can streamline your development processes, improve productivity, and optimize your IoT applications, leading to successful and secure implementations.

Share:

LinkedIn

Share
Copy link
URL has been copied successfully!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Close filters
Products Search