diff --git a/man/systemd-detect-virt.xml b/man/systemd-detect-virt.xml
index 654cf9b84c..14bfd19b62 100644
--- a/man/systemd-detect-virt.xml
+++ b/man/systemd-detect-virt.xml
@@ -69,7 +69,12 @@
kvm
- Linux KVM kernel virtual machine, with whatever software, except Oracle Virtualbox
+ Linux KVM kernel virtual machine, in combination with QEMU. Not used for other virtualizers using the KVM interfaces, such as Oracle VirtualBox or Amazon EC2 Nitro, see below.
+
+
+
+ amazon
+ Amazon EC2 Nitro using Linux KVM
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index 7f37f01ef9..b7a5ec0362 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -1192,6 +1192,7 @@
container to test against a generic type of virtualization solution, or one of
qemu,
kvm,
+ amazon,
zvm,
vmware,
microsoft,
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 335f59d6fc..03c0e431ad 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -149,6 +149,7 @@ static int detect_vm_dmi(void) {
int id;
} dmi_vendor_table[] = {
{ "KVM", VIRTUALIZATION_KVM },
+ { "Amazon EC2", VIRTUALIZATION_AMAZON },
{ "QEMU", VIRTUALIZATION_QEMU },
{ "VMware", VIRTUALIZATION_VMWARE }, /* https://kb.vmware.com/s/article/1009458 */
{ "VMW", VIRTUALIZATION_VMWARE },
@@ -344,8 +345,9 @@ int detect_vm(void) {
/* We have to use the correct order here:
*
- * → First, try to detect Oracle Virtualbox, even if it uses KVM, as well as Xen even if it cloaks as Microsoft
- * Hyper-V. Attempt to detect uml at this stage also since it runs as a user-process nested inside other VMs.
+ * → First, try to detect Oracle Virtualbox and Amazon EC2 Nitro, even if they use KVM, as well as Xen even if
+ * it cloaks as Microsoft Hyper-V. Attempt to detect uml at this stage also since it runs as a user-process
+ * nested inside other VMs.
*
* → Second, try to detect from CPUID, this will report KVM for whatever software is used even if info in DMI is
* overwritten.
@@ -353,7 +355,7 @@ int detect_vm(void) {
* → Third, try to detect from DMI. */
dmi = detect_vm_dmi();
- if (IN_SET(dmi, VIRTUALIZATION_ORACLE, VIRTUALIZATION_XEN)) {
+ if (IN_SET(dmi, VIRTUALIZATION_ORACLE, VIRTUALIZATION_XEN, VIRTUALIZATION_AMAZON)) {
r = dmi;
goto finish;
}
@@ -914,6 +916,7 @@ bool has_cpu_with_flag(const char *flag) {
static const char *const virtualization_table[_VIRTUALIZATION_MAX] = {
[VIRTUALIZATION_NONE] = "none",
[VIRTUALIZATION_KVM] = "kvm",
+ [VIRTUALIZATION_AMAZON] = "amazon",
[VIRTUALIZATION_QEMU] = "qemu",
[VIRTUALIZATION_BOCHS] = "bochs",
[VIRTUALIZATION_XEN] = "xen",
diff --git a/src/basic/virt.h b/src/basic/virt.h
index 378c7c4d23..1eafbe2cbe 100644
--- a/src/basic/virt.h
+++ b/src/basic/virt.h
@@ -10,6 +10,7 @@ enum {
VIRTUALIZATION_VM_FIRST,
VIRTUALIZATION_KVM = VIRTUALIZATION_VM_FIRST,
+ VIRTUALIZATION_AMAZON,
VIRTUALIZATION_QEMU,
VIRTUALIZATION_BOCHS,
VIRTUALIZATION_XEN,
diff --git a/src/test/test-condition.c b/src/test/test-condition.c
index db15fe3136..adba383fdd 100644
--- a/src/test/test-condition.c
+++ b/src/test/test-condition.c
@@ -575,6 +575,7 @@ static void test_condition_test_virtualization(void) {
NULSTR_FOREACH(virt,
"kvm\0"
+ "amazon\0"
"qemu\0"
"bochs\0"
"xen\0"