Download AWS IoT Python SDK
pip install awsiotsdk
Steps to configure AWS IoT Core and run the application -
-
Login to AWS IoT Core Console
-
Create a policy-
- Go to Secure
- Choose Policies
- Create a new policy
- Give a name to policy
- Under Add statements a. For Actions enter iot:* b. For Resource ARN, enter * c. For Effect, select Allow
- Choose Create
-
Create AWS Thing
- Go to Manage
- Choose Create
- Choose register a thing
- Select Create a single thing
- Give a name to your thing and select Next
- Choose Create Certificate
- Download the following : Certificate(xxx.pem.crt), Private Key(xxx.private.pem.key)
- Download RootCA file and save it as root.pem
- Choose Activate
- Select Attach a policy and select previously created policy
- Choose Register Thing
-
Get Endpoint URL
- Select Settings and go to Custom endpoint
- Copy the endpoint url ansd save it
-
Copy the downloaded certificate, private key and rootCA files to /certificates directory
-
Open config.json and update the following -
- ENDPONT : Add the custom endpoint url here
- CLIENTID : Enter the client id. For ex. TestClient1
- PATH_TO_CERT : Add path of certificate(certificates/xxx.pem.crt)
- PATH_TO_KEY : Add path of private key(certificates/xxx.private.pem.crt)
- PATH_TO_ROOT : Add path of certificate(certificates/root.pem)
- TOPIC : Add the topic. For ex. test/testing
-
Run the application
python3 publish.py