[英]AWS Boto3 BASE64 encoding error thrown when invoking client.request_spot_instances method
[英]Client error in boto3 request_spot_instances call
我正在呼吁啟動競價型實例。 我正在使用的代碼-
request_spot_instances(
SpotPrice = str(price),
ClientToken = client_token,
InstanceCount = count,
Type = 'one-time',
ValidFrom = valid_from,
ValidUntil = valid_until,
LaunchGroup = '',
AvailabilityZoneGroup = '',
BlockDurationMinutes = 120,
LaunchSpecification = {
'ImageId': image_id,
'KeyName': key_name,
'SecurityGroups': security_groups,
'UserData': user_data,
'InstanceType': instance_type,
'Placement' : placement,
'BlockDeviceMappings': block_device_map,
'SubnetId': subnet_id,
'NetworkInterfaces': [
network_interface
],
'IamInstanceProfile': iamprofile,
'Monitoring': {
'Enabled': True
}
}
)
valid_from和valid_until的值是-
valid_from = datetime.utcnow()
valid_until = datetime.utcnow() + timedelta(minutes=10)
撥打電話時出現以下錯誤-
*** ClientError: An error occurred (InvalidTime) when calling the RequestSpotInstances operation: "Sun Dec 04 22:17:59 UTC 2016" is an invalid time
如何解決此錯誤?
這應該工作:
valid_from = datetime.utcnow() + timedelta(seconds=3)
valid_until = valid_from + timedelta(minutes=10)
我遇到了同樣的問題,並得出結論, valid_from
必須是“現在”或將來的某個地方。 通過將2-3秒添加到您的valid_from
日期時間,它將起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.