loft-sh / devpod-provider-aws

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

Support arm64 EC2 instance types #11

Closed shepherdjerred closed 1 year ago

shepherdjerred commented 1 year ago

arm64 EC2 instance types are significantly cheaper than traditional x86_64 instance types. AWS reports savings of up to 40% using arm64 EC2 instances.

These instances are as performant as x86_64 instances, and the Linux ecosystem has great support for arm64 nowadays.

It would be great if this provider had support for arm64 EC2 instances. It would further decrease the cost of using DevPod, and make it significantly cheaper than GitHub Codespaces!

Cores Memory Cost per hour % difference from Codespaces
Codespaces 16 32 $1.44
c6a.4xlarge 16 32 $0.6120 57% cheaper
c5d.4xlarge 16 32 $0.7680 47% cheaper
a1.4xlarge 16 32 $0.4080 72% cheaper
c7g.4xlarge 16 32 $0.5800 60% cheaper

Cost Comparison

According to Vantage, using the hourly Linux on-demand prices in us-east-1:

All instance types have 32 GB of RAM and 16 CPUs

x86_64 instances

c6a.4xlarge: $0.6120 hourly (this is the cheapest x86_64 instance with 32GB RAM and 16 CPUs) c5.4xlarge: $0.6800 hourly c5d.4xlarge: $0.7680 hourly

arm64 instances

a1.4xlarge: $0.4080 hourly (this is AWS's first generation of arm64 CPUs) c7g.4xlarge: $0.5800 hourly (this is the latest gen of AWS's arm64 CPUs)

FabianKramm commented 1 year ago

@shepherdjerred thanks for creating this issue! Do these not work currently? They might be not in the list of machine types, but you can still type those in there and it should (hopefully) work

shepherdjerred commented 1 year ago

@shepherdjerred thanks for creating this issue! Do these not work currently? They might be not in the list of machine types, but you can still type those in there and it should (hopefully) work

Wow, I didn't realize you could type in that field... I'll give it a shot today. Thank you!

shepherdjerred commented 1 year ago

Okay, by default, this gives an error. I tried to create an instance of type c7g.8xlarge. I left the AMI empty.

[19:57:52] fatal [19:57:36] info operation error EC2: RunInstances, https response error StatusCode: 400, RequestID: 85d9e372-d340-42e4-9489-7dad7bd4d4fa, api error InvalidParameterValue: The architecture 'arm64' of the specified instance type does not match the architecture 'x86_64' of the specified AMI. Specify an instance type and an AMI that have matching architectures, and try again. You can use 'describe-instance-types' or 'describe-images' to discover the architecture of the instance type or AMI. is neither a local folder, git repository or docker image

I set the AMI ID to one for the arm64 architecture (Amazon Linux 2, AMI ID ami-0e6122f0ba6f36d96 in us-west-2). This error popped up next.

[20:00:24] info Create machine 'devpod-shared-aws' with provider 'aws'...
[20:00:26] info Successfully created machine 'devpod-shared-aws' with provider 'aws'
[20:00:31] info Creating devcontainer...
[20:00:36] info Waiting for devpod agent to come up...
[20:00:41] info Download binary AWS_PROVIDER from https://github.com/loft-sh/devpod-provider-aws/releases/download/v0.0.4/devpod-provider-aws-linux-arm64
[20:00:41] info # Executing docker install script, commit: 1d97565eca92bb523082b7d4f530c74104e05d35
[20:00:41] info ERROR: Unsupported distribution 'amzn'
[20:00:42] fatal agent error: couldn't find a package manager to install git
error parsing workspace info: rerun as root: exit status 1
: exit status 1

So, I guess Amazon Linux 2 is not supported? In any case, I switched the AMI to Ubuntu 22.04 arm64 (ami-0c79a55dda52434da in us-west-2).

That worked! Thanks for the help. I'm excited to save some cash :) This is so much better than GitHub Codespaces!!

FabianKramm commented 1 year ago

@shepherdjerred yeah amazon distro currently doesn't work because the docker install script doesn't support it which we use. But glad you got that working!

skorfmann commented 1 year ago

This should be stated somewhere in the readme

89luca89 commented 1 year ago

You're right @skorfmann , I've updated the readme! Thanks!