Skip to content

Can instances other than bare metal Run VMs with Hardware Acceleration Using KVM

0

I’m trying to run KVM-based VMs with hardware acceleration on an r5a.xlarge instance in us-east-1, but I’m unable to load the kvm_amd module.

Instance Details:

Instance Type: r5a.xlarge Region: eu-central-1 Issue: When I try to load kvm_amd, I get an error:

sudo modprobe kvm_amd modprobe: ERROR: could not insert 'kvm_amd': Operation not supported

Additionally, egrep -c '(vmx|svm)' /proc/cpuinfo returns 0, indicating SVM isn’t exposed, and kvm-ok reports that KVM acceleration cannot be used.

Question:

Can r5a.xlarge run VMs with hardware acceleration using KVM? If yes, how can I enable nested virtualization to load kvm_amd? If not, which instance types (e.g., c6g.2xlarge) support nested virtualization by default? Thank you,

asked a year ago375 views
1 Answer
0

Unfortunately, the r5a.xlarge instance type you're using does not support running VMs with hardware acceleration using KVM. Nested virtualization, which is required for running KVM-based VMs with hardware acceleration, is not officially supported on most EC2 instance types, including r5a.xlarge.

Nested virtualization is only officially supported on EC2 "bare metal" instance types. These instances provide direct access to the underlying hardware, allowing for nested virtualization capabilities. Regular EC2 instances, including r5a.xlarge, do not have this capability enabled by default.

While some users have reported success in enabling KVM on certain compute-optimized instances (like c5a series), this is not officially supported by AWS and may not be reliable or consistent across all instances or regions. It's important to note that even if you manage to enable it on a non-bare metal instance, it's not a supported configuration and may lead to unexpected behavior or performance issues.

If you absolutely need to run VMs with hardware acceleration using KVM, you should consider using a bare metal instance type. These instance types have names that end with ".metal", such as "c5.metal" or "m5.metal". These instances provide direct access to the hardware and support nested virtualization out of the box.

It's worth noting that bare metal instances are typically more expensive than their virtualized counterparts, so you should carefully consider your requirements and budget before choosing this option.

If nested virtualization is not strictly necessary for your use case, you might want to explore alternative solutions that don't require KVM, such as using container technologies or other virtualization methods that are compatible with standard EC2 instances.
Sources
EC2 Windows server 2022 not able to install WSL2 | AWS re:Post
Nested virtualisation support on EC2 compute optimized instances | AWS re:Post
Are KVM and nested virtualization supported on AWS ? | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.