loft-sh / devpod-provider-aws

DevPod on AWS
Mozilla Public License 2.0
13 stars 8 forks source link

feat: Add Spot Instance support #34

Closed pan93412 closed 3 months ago

pan93412 commented 4 months ago

Description

This PR introduces a new option, AWS_USE_SPOT_INSTANCE, which creates an EC2 Spot instance with InstanceMarketOptions and destroy the Spot request when deleting the instance.

Why don't I use Fleet? Fleet does not allow the stop and start of an instance, which is not suitable for our cases. Instead, I start a persistent request of a single Spot machine.

Additionally, I found that "Spot Instances" can reduce the workspace cost by more than 80%.

CleanShot 2024-06-07 at 01 45 32@2x

Resolved #12

Usage

Create a custom provider with the URL: https://github.com/pan93412/devpod-provider-aws/releases/download/0.3.0/provider.yaml

Tests

[!NOTE] It took some time to allow the user to restart the Spot instance, as we needed to wait for the Spot Request to be disabled completely.

pascalbreuninger commented 3 months ago

Hi @pan93412, thanks for your contribution, I've totally missed this PR 😅

LGTM overall, I'd merge it and release an alpha version for others to test out