boto3: Convert AMI Creation Date from string to Python datetime

When retrieving the AMI Creation Date from boto3 it returns a string data type. Visually, this is okay but it is challenging to do operations and comparisons to the AMI Creation Date like if the date is before or after a certain date.

To solve the issue we need to convert the AMI Creation Date from type string to datetime before we could do some operations.

The AMI Creation Date string looks like <strong><span style="color:#e53b51" class="tadv-color">2019-09-18T07:34:34.000Z</span></strong>. To convert this we need to use the strptime function from the datetime.datetime library.

Continue reading boto3: Convert AMI Creation Date from string to Python datetime