Ability to change machine type / spec
Is your feature request related to a problem?
No
Which solution do you suggest?
We should be able to resize the instances created by the provider.
Through CLI something like (assuming an AWS Instance):
devpod machine set-options "$machinename" --option AWS_INSTANCE_TYPE="inf1.xlarge"
which would internally invoke the AWS API like this:-
aws ec2 modify-instance-attribute \
--instance-id "$machineid" \
--instance-type "{\"Value\":\"inf1.xlarge\"}"
Similar things can be pulled off iwth docker and kubernetes.
Which alternative solutions exist?
In Codespace, we can adjust instance type pretty easily.
Additional context
Edge case:
- Some providers such as AWS do require instances to be stopped before the instance size can be changed.
- Haven't gone into dept for all providers, but not all providers may support this functionality.
Hi @sansmoraxz, thanks for opening the issue.
This would definitely make for a way better user experience. Right now you'd either have to edit the provider to use another instance type or clone the existing provider using devpod provider add --from-existing=aws ..., then set the instance type and create a new workspace with the new provider.
Out of curiosity: How often did you have to resize the machine so far?
Mostly for switching between RAM/ CPU for whether I am programming (only language server) vs running a full fledged dev server.
Implementing an API for exposing machine metadata might be a pre-requisite here.
The way i've implemented this in my multipass machine provider is to put the logic to update the instance specs within the Start command. The logic is of course different depending on the provider. For example, in the case of AWS, you can do something like this prior to starting the instance
if instance state == stopped && instance specs need updating {
update specs
}
then the workflow to update specs of an instance is something like this
- update provider options
- stop machine
- start machine