Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codebuild/cd/test-prod-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ phases:
- CURRENT_TAG_VERSION=$(cat $CODEBUILD_SRC_DIR/VERSION)
- python3 codebuild/cd/pip-install-with-retry.py --no-cache-dir --user awsiotsdk==$CURRENT_TAG_VERSION
# Run PubSub sample
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --verbosity Trace
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem

post_build:
commands:
Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/test-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ phases:
- python3 -m pip install typing
- python3 codebuild/cd/pip-install-with-retry.py -i https://testpypi.python.org/simple --user awsiotsdk==$CURRENT_TAG_VERSION
# Run PubSub sample
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem --ca_file /tmp/AmazonRootCA1.pem --verbosity Trace
- python3 samples/mqtt/mqtt5_x509.py --endpoint ${ENDPOINT} --cert /tmp/certificate.pem --key /tmp/privatekey.pem

post_build:
commands:
Expand Down
1 change: 0 additions & 1 deletion documents/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ Here is an example launch.json file to run the pubsub sample
"program": "${workspaceFolder}/samples/mqtt/mqtt5_x509.py",
"args": [
"--endpoint", "<account-number>-ats.iot.<region>.amazonaws.com",
"--ca_file", "<path to root-CA>",
"--cert", "<path to cert>",
"--key", "<path to key>",
"--client_id", "test-client"
Expand Down
5 changes: 2 additions & 3 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sample for the AWS IoT Device SDK v2 for Python
# Sample Applications for the AWS IoT Device SDK v2 for Python
This directory contains sample applications for [aws-iot-device-sdk-python-v2](../README.md).

### Table of Contents
Expand Down Expand Up @@ -41,7 +41,7 @@ This directory contains sample applications for [aws-iot-device-sdk-python-v2](.

### Instructions

First, install `aws-iot-devices-sdk-python-v2`. Installation instructions for the SDK are [Provided Here](../README.md#Installation).
First, install `aws-iot-device-sdk-python-v2`. Installation instructions for the SDK are [Provided Here](../README.md#Installation).

Each sample's README contains prerequisites, arguments, and detailed instructions. For example, the [MQTT5 X509 Sample README](./mqtt/mqtt5_x509.md) is `mqtt5_x509.md` and the sample can be run with the following command:

Expand Down Expand Up @@ -72,7 +72,6 @@ required arguments:

optional arguments:
--client_id Client ID (default: mqtt5-sample-5873a450)
--ca_file Path to optional CA bundle (PEM) (default: None)
--topic Topic (default: test/topic)
--message Message payload (default: Hello from mqtt5 sample)
--count Messages to publish (0 = infinite) (default: 5)
Expand Down
4 changes: 2 additions & 2 deletions samples/mqtt/mqtt5_custom_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ To Run this sample from the `samples\mqtt` folder, use the following command:
# For an unsigned custom authorizer
python3 mqtt5_custom_auth_unsigned.py \
--endpoint <AWS IoT endpoint> \
--authorizer_name <The name of the custom authorizer to connect to invoke> \
--authorizer_name <The name of the custom authorizer to invoke> \
--auth_username <The name to send when connecting through the custom authorizer>\
--auth_password <The password to send when connecting through a custom authorizer>

# For a signed custom authorizer
python3 mqtt5_custom_auth_signed.py \
--endpoint <AWS IoT endpoint> \
--authorizer_name <The name of the custom authorizer to connect to invoke> \
--authorizer_name <The name of the custom authorizer to invoke> \
--auth_token_key_name <Authorizer token key name> \
--auth_token_key_value <Authorizer token key value> \
--auth_signature <Custom authorizer signature> \
Expand Down
5 changes: 1 addition & 4 deletions samples/mqtt/mqtt5_pkcs11_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,12 @@ required arguments:
--pin User PIN for logging into PKCS#11 token (default: None)

optional arguments:
--port Port (8883 mTLS, 443 ALPN) (default: 8883)
--token_label Label of the PKCS#11 token to use (optional). (default: None)
--slot_id Slot ID containing the PKCS#11 token to use (optional). (default: None)
--key_label Label of private key on the PKCS#11 token (optional). (default: None)
--ca_file Path to optional CA bundle (PEM) (default: None)
--topic Topic (default: test/topic)
--message Message payload (default: Hello from mqtt5 sample)
--count Messages to publish (0 = infinite) (default: 5)

--client_id Client ID (default: mqtt5-sample-<uuid>)
```

Expand Down Expand Up @@ -167,7 +164,7 @@ The steps to use [SoftHSM2](https://www.opendnssec.org/softhsm/) as the PKCS#11

```sh
# For Windows: replace 'python3' with 'python' and '/' with '\'
python3 mqtt5_pkcs11_connect.py --endpoint <endpoint> --ca_file <path to root CA> --cert <path to certificate> --pkcs11_lib <path to PKCS11 lib> --pin <user-pin> --token_label <token-label> --key_label <key-label>
python3 mqtt5_pkcs11_connect.py --endpoint <endpoint> --cert <path to certificate> --pkcs11_lib <path to PKCS11 lib> --pin <user-pin> --token_label <token-label> --key_label <key-label>
```

## Additional Information
Expand Down
7 changes: 0 additions & 7 deletions samples/mqtt/mqtt5_pkcs11_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
# Required Arguments
required.add_argument("--endpoint", required=True, metavar="", dest="input_endpoint",
help="IoT endpoint hostname")
optional.add_argument("--port", type=int, default=8883, metavar="", dest="input_port",
help="Port (8883 mTLS, 443 ALPN)")
required.add_argument("--cert", required=True, metavar="", dest="input_cert",
help="Path to the certificate file to use during mTLS connection establishment")
required.add_argument("--pkcs11_lib", required=True, metavar="", dest="input_pkcs11_lib_path",
Expand All @@ -34,15 +32,12 @@
help="Slot ID containing the PKCS#11 token to use (optional).")
optional.add_argument("--key_label", metavar="", dest="input_pkcs11_key_label",
help="Label of private key on the PKCS#11 token (optional).")
optional.add_argument("--ca_file", metavar="", dest="input_ca",
help="Path to optional CA bundle (PEM)")
optional.add_argument("--topic", default="test/topic", metavar="", dest="input_topic",
help="Topic")
optional.add_argument("--message", default="Hello from mqtt5 sample", metavar="", dest="input_message",
help="Message payload")
optional.add_argument("--count", type=int, default=5, metavar="", dest="input_count",
help="Messages to publish (0 = infinite)")

optional.add_argument("--client_id", metavar="", dest="input_clientId", default=f"mqtt5-sample-{uuid.uuid4().hex[:8]}",
help="Client ID")

Expand Down Expand Up @@ -102,8 +97,6 @@ def on_lifecycle_disconnection(lifecycle_disconnect_data: mqtt5.LifecycleDisconn
private_key_label=args.input_pkcs11_key_label,
cert_filepath=args.input_cert,
endpoint=args.input_endpoint,
port=args.input_port,
ca_filepath=args.input_ca,
on_lifecycle_stopped=on_lifecycle_stopped,
on_lifecycle_connection_success=on_lifecycle_connection_success,
on_lifecycle_connection_failure=on_lifecycle_connection_failure,
Expand Down
1 change: 0 additions & 1 deletion samples/mqtt/mqtt5_x509.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ required arguments:

optional arguments:
--client_id Client ID (default: mqtt5-sample-<uuid>)
--ca_file Path to optional CA bundle (PEM) (default: None)
--topic Topic (default: test/topic)
--message Message payload (default: Hello from mqtt5 sample)
--count Messages to publish (0 = infinite) (default: 5)
Expand Down
3 changes: 0 additions & 3 deletions samples/mqtt/mqtt5_x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
# Optional Arguments
optional.add_argument("--client_id", metavar="",dest="input_clientId", default=f"mqtt5-sample-{uuid.uuid4().hex[:8]}",
help="Client ID")
optional.add_argument("--ca_file", metavar="",dest="input_ca",
help="Path to optional CA bundle (PEM)")
optional.add_argument("--topic", metavar="",default="test/topic", dest="input_topic",
help="Topic")
optional.add_argument("--message", metavar="",default="Hello from mqtt5 sample", dest="input_message",
Expand Down Expand Up @@ -107,7 +105,6 @@ def on_lifecycle_disconnection(lifecycle_disconnect_data: mqtt5.LifecycleDisconn
endpoint=args.input_endpoint,
cert_filepath=args.input_cert,
pri_key_filepath=args.input_key,
ca_filepath=args.input_ca,
on_publish_received=on_publish_received,
on_lifecycle_stopped=on_lifecycle_stopped,
on_lifecycle_attempting_connect=on_lifecycle_attempting_connect,
Expand Down
6 changes: 2 additions & 4 deletions test/test_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ def test_pubsub(self):
"--cert", config.cert_filepath,
"--key", config.key_filepath,
"--client_id", create_client_id(),
"--count", "1",
"--verbosity", "Trace",
"--count", "1"
]

def stdout_checker(stdout):
Expand All @@ -128,8 +127,7 @@ def test_basic_discovery_response_only(self):
"--region", config.region,
"--cert", config.cert_filepath,
"--key", config.key_filepath,
"--thing_name", "CI_Greengrass_Discovery_Thing",
"--verbosity", "Trace",
"--thing_name", "CI_Greengrass_Discovery_Thing"
]

def stdout_checker(stdout):
Expand Down