Python | How to parse JSON from results from AWS response?


I was trying to get the value of VersionLabel which is php-v1 but my code doesn’t work properly and I don’t know what I’m doing wrong.

Could you please let me know what’s wrong and how can I parse the php-v1?

This is my error message.

TypeError: the JSON object must be str, not 'dict'

This is my code.

This is the response I got from AWS when print(response) is invoked.

Thanks so much!


As per the boto3 docs [], the describe_instances_health method returns dict and not json. Hence, there is no need for you to do the conversion.
To get VersionLabel from data, use –

Edit : Note that the above fetches the VersionLabel for the first instance, out of possible multiple instances. In case you have multiple instances and they happen to have different values of VersionLabel, then you would require additional logic to get the one you need.

Leave a Reply