A script to set up and manage a secure tunnel to an AWS IoT device
Project description
AWS IoT Tunnel Script
Overview
The aws_iot_tunnel.py script sets up and manages a secure tunnel to an AWS IoT device using the AWS IoT Secure Tunneling feature by checking for existing open tunnels to avoid unnecessary opening of new tunnels. It leverages prebuilt Docker images from aws-iot-securetunneling-localproxy to create a secure connection, enabling interaction with IoT devices from your local environment. By opening a tunnel on your machine, you can easily use development tools like VSCode, which cannot be utilized via the AWS web UI.
Table of Contents
Requirements
Before running the script, ensure you have the following installed:
- Python 3.x
- AWS CLI (Configured)
- Docker: Required to run the tunnel in a container.
- boto3 (AWS SDK): To manage secure tunneling (automatically installed with pip).
- docker (Docker SDK): To manage docker container (automatically installed with pip).
Installation
Download the script directly or clone this repository:
pip install aws-iot-tunnel
OR
git clone https://github.com/smartdings/aws-development-tools.git
pip install ./aws-development-tools/iot/tunnel
Usage
-
Run the docker container.
aws-iot-tunnel -t MyIoTThing -p myawsprofile -r us-west-2
-
Connect to the iot thing using SSH.
ssh user@localhost -p 5555
Command-Line Arguments
| Argument | Short Form | Type | Required | Description |
|---|---|---|---|---|
--thing-name |
-t |
string | Yes | Name of the AWS IoT Thing to connect to. |
--port |
-P |
int | No | Port to bind (defaults to 5555). |
--profile |
-p |
string | No | AWS profile to use for authentication. |
--region |
-r |
string | No | AWS region to use (defaults to the configured region). |
--remove-fingerprint |
-R |
No | Remove SSH fingerprint on localhost with specified port. |
How It Works
- boto3 SDK: The script interacts with the AWS IoT Secure Tunneling service using boto3 SDK to manage tunnels and rotate access tokens.
- Docker Integration: It runs a Docker container configured for the appropriate architecture to establish a secure tunnel to the specified IoT device.
- Token Management: The script checks for existing tunnels and manages the source access tokens required for secure communication.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Key Features of the README
- Overview: A brief introduction to what the script does.
- Requirements: Specifies what is needed to run the script.
- Installation: Instructions on how to set up the script.
- Usage: Clear command examples for users to follow.
- Command-Line Arguments: A table detailing each argument, its type, and whether it's required.
- How It Works: A high-level explanation of the script's functionality.
- License: Information about the licensing of the project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws_iot_tunnel-0.9.tar.gz.
File metadata
- Download URL: aws_iot_tunnel-0.9.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ec47ee278e99f6ea08296c6a4d0c353582c5333c3d35b4a147e17cdc6f4325e
|
|
| MD5 |
8cbbc8dce8d2e7c2e0ec37ec13c3a91b
|
|
| BLAKE2b-256 |
4f792708acbebc495bc053c7997420f3051384b8e0042702546bd036232a0db7
|
File details
Details for the file aws_iot_tunnel-0.9-py3-none-any.whl.
File metadata
- Download URL: aws_iot_tunnel-0.9-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c891255889483a9d5017401da4999ab969710f0d27194825b25da8f53161a737
|
|
| MD5 |
95fe51eee152aec7474118d5142b7da0
|
|
| BLAKE2b-256 |
46af48a4e3925aa5301fff0772e71cb4c8e4696d2920432a0ed9dd0be41e18a0
|