Skip to content

EC2 RequestSpotFleet ValidFrom / ValidUntil timestamp issue #714

Closed
@jantman

Description

@jantman

Passing a DateTime as the ValidFrom or ValidUntil argument to ec2 client request_spot_instances() works fine. However, passing a similar DateTime object to request_spot_fleet() results in an invalid parameter value from EC2: botocore.exceptions.ClientError: An error occurred (InvalidSpotFleetRequestConfig) when calling the RequestSpotFleet operation: Parameter: SpotFleetRequestConfig.ValidFrom is invalid.

The problem appears to be that request_spot_fleet() sends the parameter as a string in YYYY-MM-DDTHH:MM:SS.xxxxxxZ format (debug-level logging on a call to request_spot_fleet() where ValidFrom and ValidUntil are DateTimes shows the request as including u'SpotFleetRequestConfig.ValidFrom': '2016-07-29T19:32:29.648833Z', u'SpotFleetRequestConfig.ValidUntil': '2016-07-29T19:32:30.648833Z').

If I change the call to have arguments of ValidFrom=valid_from.strftime('%Y-%m-%dT%H:%M:%SZ'), ValidUntil=valid_to.strftime('%Y-%m-%dT%H:%M:%SZ') it then works correctly.

I don't know if this is an issue with boto3 or on the AWS side, but it appears that there needs to be some additional manipulation of the timestamp string sent to AWS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closing-soonThis issue will automatically close in 4 days unless further comments are made.guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions