+{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": "iot:Publish", + "Resource": [ + "arn:aws:iot:region:account:topic/$aws/certificates/create/json", + "arn:aws:iot:region:account:topic/$aws/certificates/create-from-csr/json", + "arn:aws:iot:region:account:topic/$aws/provisioning-templates/templatename/provision/json" + ] + }, + { + "Effect": "Allow", + "Action": [ + "iot:Receive" + ], + "Resource": [ + "arn:aws:iot:region:account:topic/$aws/certificates/create/json/accepted", + "arn:aws:iot:region:account:topic/$aws/certificates/create/json/rejected", + "arn:aws:iot:region:account:topic/$aws/certificates/create-from-csr/json/accepted", + "arn:aws:iot:region:account:topic/$aws/certificates/create-from-csr/json/rejected", + "arn:aws:iot:region:account:topic/$aws/provisioning-templates/templatename/provision/json/accepted", + "arn:aws:iot:region:account:topic/$aws/provisioning-templates/templatename/provision/json/rejected" + ] + }, + { + "Effect": "Allow", + "Action": [ + "iot:Subscribe" + ], + "Resource": [ + "arn:aws:iot:region:account:topicfilter/$aws/certificates/create/json/accepted", + "arn:aws:iot:region:account:topicfilter/$aws/certificates/create/json/rejected", + "arn:aws:iot:region:account:topicfilter/$aws/certificates/create-from-csr/json/accepted", + "arn:aws:iot:region:account:topicfilter/$aws/certificates/create-from-csr/json/rejected", + "arn:aws:iot:region:account:topicfilter/$aws/provisioning-templates/templatename/provision/json/accepted", + "arn:aws:iot:region:account:topicfilter/$aws/provisioning-templates/templatename/provision/json/rejected" + ] + }, + { + "Effect": "Allow", + "Action": "iot:Connect", + "Resource": "arn:aws:iot:region:account:client/test-*" + } + ] +} ++ +Replace with the following with the data from your AWS account: +* `
Create a IoTIdentityClient with Mqtt5 | +Create a IoTIdentityClient with Mqtt311 | +
---|---|
+ +```python + # Create a Mqtt5 Client + mqtt5_client = mqtt5_client_builder.mtls_from_path( + endpoint, + port, + cert_filepath, + pri_key_filepath, + ca_filepath, + client_id, + clean_session, + keep_alive_secs, + http_proxy_options, + on_lifecycle_connection_success, + on_lifecycle_stopped) + + # Create the Identity Client from Mqtt5 Client + identity_client = iotidentity.IotIdentityClient(mqtt5_client) +``` + + | ++ +```python + # Create a Mqtt311 Connection from the command line data + mqtt_connection = mqtt_connection_builder.mtls_from_path( + endpoint, + port, + cert_filepath, + pri_key_filepath, + ca_filepath, + client_id, + clean_session, + keep_alive_secs, + http_proxy_options) + + # Create the Identity Client from Mqtt311 Connection + identity_client = iotidentity.IotIdentityClient(mqtt_connection) +``` + + | +
+{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": "iot:Publish", + "Resource": [ + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/start-next", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/*/update", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/*/get", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/get" + ] + }, + { + "Effect": "Allow", + "Action": "iot:Receive", + "Resource": [ + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/notify-next", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/start-next/*", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/*/update/*", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/get/*", + "arn:aws:iot:region:account:topic/$aws/things/thingname/jobs/*/get/*" + ] + }, + { + "Effect": "Allow", + "Action": "iot:Subscribe", + "Resource": [ + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/jobs/notify-next", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/jobs/start-next/*", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/jobs/*/update/*", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/jobs/get/*", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/jobs/*/get/*" + ] + }, + { + "Effect": "Allow", + "Action": "iot:Connect", + "Resource": "arn:aws:iot:region:account:client/test-*" + } + ] +} ++ +Replace with the following with the data from your AWS account: +* `
Create a IotJobsClient with Mqtt5 | +Create a IotJobsClient with Mqtt311 | +
---|---|
+ +```python + # Create a Mqtt5 Client + mqtt5_client = mqtt5_client_builder.mtls_from_path( + endpoint, + port, + cert_filepath, + pri_key_filepath, + ca_filepath, + client_id, + clean_session, + keep_alive_secs, + http_proxy_options, + on_lifecycle_connection_success, + on_lifecycle_stopped) + + # Create the Jobs client from Mqtt5 Client + jobs_client = iotjobs.IotJobsClient(mqtt5_client) +``` + + | ++ +```python + # Create a Mqtt311 Connection from the command line data + mqtt_connection = mqtt_connection_builder.mtls_from_path( + endpoint, + port, + cert_filepath, + pri_key_filepath, + ca_filepath, + client_id, + clean_session, + keep_alive_secs, + http_proxy_options) + + # Create the Jobs client from Mqtt311 Connection + jobs_client = iotjobs.IotJobsClient(mqtt_connection) +``` + + | +
+{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "iot:Publish" + ], + "Resource": [ + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/get", + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/update" + ] + }, + { + "Effect": "Allow", + "Action": [ + "iot:Receive" + ], + "Resource": [ + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/get/accepted", + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/get/rejected", + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/update/accepted", + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/update/rejected", + "arn:aws:iot:region:account:topic/$aws/things/thingname/shadow/update/delta" + ] + }, + { + "Effect": "Allow", + "Action": [ + "iot:Subscribe" + ], + "Resource": [ + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/shadow/get/accepted", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/shadow/get/rejected", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/shadow/update/accepted", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/shadow/update/rejected", + "arn:aws:iot:region:account:topicfilter/$aws/things/thingname/shadow/update/delta" + ] + }, + { + "Effect": "Allow", + "Action": "iot:Connect", + "Resource": "arn:aws:iot:region:account:client/test-*" + } + ] +} ++ +Replace with the following with the data from your AWS account: +* `
Create a IotShadowClient with Mqtt5 | +Create a IotShadowClient with Mqtt311 | +
---|---|
+ +```python + # Create a Mqtt5 Client + mqtt5_client = mqtt5_client_builder.mtls_from_path( + endpoint, + port, + cert_filepath, + pri_key_filepath, + ca_filepath, + client_id, + clean_session, + keep_alive_secs, + http_proxy_options, + on_lifecycle_connection_success, + on_lifecycle_stopped) + + # Create the shadow client from Mqtt5 Client + shadow_client = iotshadow.IotShadowClient(mqtt5_client) +``` + + | ++ +```python + # Create a Mqtt311 Connection from the command line data + mqtt_connection = mqtt_connection_builder.mtls_from_path( + endpoint, + port, + cert_filepath, + pri_key_filepath, + ca_filepath, + client_id, + clean_session, + keep_alive_secs, + http_proxy_options) + + # Create the shadow client from Mqtt311 Connection + shadow_client = iotshadow.IotShadowClient(mqtt_connection) +``` + + | +