ssm describe_instance_patches OverflowError: date value out of range
See original GitHub issueI am currently looking into boto3 ssm client and calling the describe_instance_patches for a given instance, and i run into the following error: “*** OverflowError: date value out of range”
I have used the boto3 library version: boto3==1.9.42 (This is the same as the default in Lambda. I have also used the latest version: boto3==1.9.203 and this has the same issue. i prefer the 1.9.203 release as this includes pagination for the resposne)
I was able to resolve this on my own machine by changing my environment variable for TZ to UTC:
export TZ="/usr/share/zoneinfo/utc"
I believe this issue happens because Amazon works on UTC, so the timezone on the response is UTC and is being converted to my local timezone, which errors.
Any assistance on this would be ace.
If you want test this yourself (I am assuming you have already got credentials present for boto3):
import boto3
from pprint import pprint
def get_instance_patches(client, instance_id):
paginator = client.get_paginator("describe_instance_patches")
for page in paginator.paginate(InstanceId=instance_id):
for patch in page.get("Patches", []):
yield patch
def list_instances(client):
paginator = client.get_paginator("describe_instance_information")
for page in paginator.paginate():
for instance in page["InstanceInformationList"]:
yield instance
if __name__ == "__main__":
client = boto3.client("ssm")
for instance in list_instances(client):
instance_id = instance["InstanceId"]
for patch in get_instance_patches(client, instance_id):
pprint(patch)
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (10 by maintainers)
Top GitHub Comments
Hi, I don’t believe it is fixed, I’m currently using latest versions of botocore and boto3 and facing the exact same issue. @jack1902 could you confirm if you’re still seeing the issue on your side as well ?
@jack1902 - This issue occurs only when the service returns negative timestamp. I don’t have any exact time frame but there is already a corresponding CR for it. I will post here when i will get any update from the service side.
Can you please post the logs for CLI ? I am curious to know what is the response you are getting from the service. You can enable the log by adding
--debug
to your code.