Skip to content

Commit 1aeb1ee

Browse files
authored
Moved and renamed tunnel notification sample and added a secure tunne… (#350)
* Added a secure_tunnel sample that connects through the AWS secure tunnel endpoint as well as through an optional proxy server. * Added the secure_tunnel sample and the tunnel_notification samples to build_samples.py
1 parent 2d8447c commit 1aeb1ee

File tree

7 files changed

+455
-3
lines changed

7 files changed

+455
-3
lines changed

.builder/actions/build_samples.py

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def run(self, env):
1717
'samples/greengrass/basic_discovery',
1818
'samples/identity/fleet_provisioning',
1919
'samples/jobs/describe_job_execution',
20+
'samples/secure_tunneling/secure_tunnel',
21+
'samples/secure_tunneling/tunnel_notification',
2022
]
2123
for sample_path in samples:
2224
build_path = os.path.join('build', sample_path)

samples/README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,31 @@ using a permanent certificate set, replace the paths specified in the `--cert` a
443443
--csr /tmp/deviceCert.csr
444444
```
445445

446-
## Secure Tunneling
446+
## Secure Tunnel
447+
448+
This sample uses AWS IoT [Secure Tunneling](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html) Service to connect a destination and a source with each other through the AWS Secure Tunnel endpoint using access tokens.
449+
450+
Create a new secure tunnel in the AWS IoT console (https://console.aws.amazon.com/iot/) (AWS IoT/Manage/Tunnels/Create tunnel) and retrieve the destination and source access tokens. (https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling-tutorial-open-tunnel.html)
451+
452+
Provide the necessary arguments along with the destination access token and start the sample in destination mode (default).
453+
454+
Provide the necessary arguments along with the source access token and start a second sample in source mode by using the flag --localProxyModeSource.
455+
456+
The two samples will then connect to each other through the AWS Secure Tunnel endpoint and establish a stream through which data can be trasmitted in either direction.
457+
458+
A proxy server may be used by providing the --proxy_host and --proxy_port arguments. If the proxy server requires a user name and password the --proxy_user_name and --proxy_password arguments should be used.
459+
460+
Source: `samples/secure_tunneling/secure_tunnel`
461+
462+
## Secure Tunnel Notification
447463

448464
This sample uses the AWS IoT [Secure Tunneling](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html) Service to receive a tunnel notification.
449465

450466
This sample requires you to create a tunnel for your thing. See [instructions here](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling-tutorial.html).
451467

452468
On startup, the sample will wait until it receives, and then displays the tunnel notification.
453469

454-
Source: `samples/secure_tunneling`
470+
Source: `samples/secure_tunneling/tunnel_notification`
455471

456472
## Greengrass discovery
457473

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
# note: cxx-17 requires cmake 3.8, cxx-20 requires cmake 3.12
3+
project(secure-tunnel CXX)
4+
5+
file(GLOB SRC_FILES
6+
"*.cpp"
7+
)
8+
9+
add_executable(${PROJECT_NAME} ${SRC_FILES})
10+
11+
set_target_properties(${PROJECT_NAME} PROPERTIES
12+
CXX_STANDARD 14)
13+
14+
#set warnings
15+
if (MSVC)
16+
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
17+
else ()
18+
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror)
19+
endif ()
20+
21+
find_package(aws-crt-cpp REQUIRED)
22+
find_package(IotDeviceCommon-cpp REQUIRED)
23+
find_package(IotSecureTunneling-cpp REQUIRED)
24+
25+
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
26+
27+
target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp AWS::IotDeviceCommon-cpp AWS::IotSecureTunneling-cpp)

0 commit comments

Comments
 (0)