boto / boto3

AWS SDK for Python
https://aws.amazon.com/sdk-for-python/
Apache License 2.0
8.99k stars 1.86k forks source link

Request for Addition of API to Adjust Spot Instance Limit #4133

Closed rawhuul closed 4 months ago

rawhuul commented 4 months ago

Describe the feature

I encountered an issue while working with spot instances. Upon attempting to request spot instances, I received the following error message:

An error occurred (MaxSpotInstanceCountExceeded) when calling the RequestSpotInstances operation: Max spot instance count exceeded

After some investigation, it appears that there isn't currently an API available to modify this limit. Consequently, I'm unable to adjust the spot instance limit to accommodate my needs.

Is it be possible to add API or providing a mechanism to adjust the spot instance limit?

Use Case

To adjust spot instance limit

Proposed Solution

No response

Other Information

No response

Acknowledgements

SDK version used

1.24.70

Environment details (OS name and version, etc.)

20.04.1-Ubuntu (Kernel: 5.15.0-1047-aws)

tim-finnigan commented 4 months ago

Thanks for the feature request. As noted here:

The service quota for spot instances is limited by the number of vCPUs, not the number of instances.

The number of vCPUs for each instance type can be found here: https://aws.amazon.com/ec2/instance-types/?nc1=h_ls. And you can find documentation on requesting quota increases here: https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html

It looks like you can do this programmatically via the request_service_quota_increase command. For example:

import boto3

# Create a Service Quotas client
service_quotas = boto3.client('service-quotas')

# Request an increase in the Spot Instance limit
response = service_quotas.request_service_quota_increase(
    ServiceCode='ec2',
    QuotaCode='L-1216C47A',
    DesiredValue=1000,  # Set the desired value for the new limit
)

# Check the response
print(response)

For any requests involving service APIs please create a new issue in our cross-SDK repository and we can bring those up to the appropriate team.

I also noticed you're using version 1.24.70 which is very old. The latest version of Boto3 per the CHANGELOG is 1.34.107. Please consider updating your version of Boto3 for access to the latest updates/fixes.

github-actions[bot] commented 4 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.