HTTP Calls to Amazon Web Services Rest API for IoT Core Shadow Actions π»ππ‘
This simple script implements the following aws iot calls via Rest Api:
- GetThingShadow
- UpdateThingShadow
- ListNamedShadowForThing
NB: You must enable your device via this aws policy:
{
"Effect": "Allow",
"Action": [
"iot:GetThingShadow",
"iot:UpdateThingShadow",
"iot:DeleteThingShadow"
],
"Resource": "arn:aws:iot:ca-central-1:XXXXXXXXXXXX:thing/${iot:Connection.Thing.ThingName}"
}
See the official documentation here and here.
Run the following command to install all the necessary dependencies:
pip install -r requirements.txt
-
Edit app-config.json and modify properties by entering your data (e.g. AWS API Secrets, endpoint url etc).
-
Launch api-client.py:
python3 api-client.py
- You will be offered 3 options:
Type 1 for GetThingShadow, 2 for UpdateThingShadow, 3 for ListNamedShadowsForThing
- Choose the preferred option and test the corresponding shadow action, via REST Api call.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.