Skip to content

WebRTC on Raspberry Pi Zero W2

0

I am follow the instructions on https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/how-iot.html. I get to step 4. and I get an error

aws --profile default iot create-policy --policy-name KvsCameraIoTPolicy --policy-document 'file://iot-policy-document.json'

An error occurred (MalformedPolicyException) when calling the CreatePolicy operation: Policy document is Malformed: The following resources are invalid : $(jq --raw-output '.roleAliasArn' iot-role-alias.json)

How do I fix this?

asked 2 years ago158 views

2 Answers
0

The error you're encountering suggests that there's an issue with the policy document you're trying to create. Specifically, the error indicates that the resource specified in your policy document is invalid.

This error typically occurs when the policy document contains placeholders or variables that haven't been properly replaced with actual values. In this case, it seems that the placeholder $(jq --raw-output '.roleAliasArn' iot-role-alias.json) is still present in your policy document.

To fix this issue, you need to ensure that all placeholders in your iot-policy-document.json file are replaced with actual values before running the aws iot create-policy command. Here's what you should do:

  1. Open your iot-policy-document.json file and locate the line containing the placeholder.

  2. Replace the placeholder with the actual Role Alias ARN. You can get this value by running:

    jq --raw-output '.roleAliasArn' iot-role-alias.json

  3. Make sure you've replaced all other placeholders in the policy document with their corresponding values.

  4. Save the updated iot-policy-document.json file.

  5. Run the aws iot create-policy command again with the updated policy document.

If you're still having trouble, double-check that the iot-role-alias.json file exists and contains the expected roleAliasArn value. Also, ensure that you have the necessary permissions to create IoT policies and that your AWS CLI is configured correctly with the right credentials and region.

Remember, when working with IoT policies and role aliases, it's crucial to follow AWS best practices for security and to grant only the necessary permissions required for your specific use case.
Sources
Grant permission - Kinesis Video Streams
Troubleshooting Amazon Kinesis Video Streams with WebRTC - Kinesis Video Streams

answered 2 years ago

AWS
EXPERT

reviewed 2 years ago

  • or maybe just install jq

0

If you are comfortable, you could post the contents of your iot-policy-document.json file and we could help spot/correct the error.

AWS
EXPERT

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.