How to Check CPU Model and Flags in an Amazon EC2 Instance?
Verifying the exact processor model and available instruction set flags inside a running Amazon EC2 instance is essential for performance tuning, software compatibility, and compiling optimized code. Because certain EC2 instance families can be backed by slightly different generations of Intel Xeon, AMD EPYC, or AWS Graviton processors, inspecting the guest operating system directly ensures you know the exact hardware allocated to your virtual machine. On Linux instances, you can retrieve this information using built-in utilities like lscpu and the procfs virtual filesystem, while Windows instances provide these details through PowerShell and WMI queries.
Checking CPU Details on Linux EC2 Instances
Linux provides immediate access to processor hardware details and instruction flags exposed by the AWS Nitro or Xen hypervisor.
Using the lscpu Command
The lscpu utility gathers CPU architecture information
from sysfs and /proc/cpuinfo and presents it
in a clean, human-readable format. Run the following command in your
terminal:
lscpuKey fields to inspect in the output include:
- Architecture: Indicates whether you are running on
x86_64(Intel/AMD) oraarch64(AWS Graviton). - Vendor ID: Shows
GenuineIntel,AuthenticAMD, orARM. - Model name: Displays the exact processor model
string (for example,
Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHzorAMD EPYC 7R13 Processor). - Flags: Lists all supported CPU instruction set
extensions (labelled as
Flagson x86_64 andFlagsorFeatureson ARM).
To filter only the model name and flags with lscpu,
run:
lscpu | grep -E "Model name|Flags"Inspecting /proc/cpuinfo Directly
For scripting or inspecting per-core details, you can query
/proc/cpuinfo directly. To view the processor model name of
the first logical core:
grep -m 1 "model name" /proc/cpuinfoNote that on AWS Graviton (ARM64) instances,
/proc/cpuinfo does not always include a
model name line. Instead, it reports
CPU implementer, CPU architecture,
CPU variant, and CPU part hex codes, making
lscpu or dmidecode more descriptive for
Graviton model identification.
To list all instruction set flags on an x86_64 instance from
/proc/cpuinfo:
grep -m 1 "^flags" /proc/cpuinfoOn AWS Graviton (ARM64) instances, instruction set extensions are
listed under Features rather than flags:
grep -m 1 "^Features" /proc/cpuinfoChecking for Specific Instruction Set Flags
When verifying support for workloads that require vector extensions
(such as avx2, avx512f, vnni on
x86, or sve, asimd, crc32 on
Graviton), you can test for a specific flag programmatically:
grep -qw "avx512f" /proc/cpuinfo && echo "Supported" || echo "Not Supported"Using dmidecode for SMBIOS Processor Information
On Nitro-based EC2 instances and bare metal instances
(*.metal), you can also read the SMBIOS processor table
using dmidecode:
sudo dmidecode -t processorThis outputs the socket designation, manufacturer, processor version, and clock speed reported by the instance firmware.
Checking CPU Details on Windows EC2 Instances
If you are running a Windows Server AMI on Amazon EC2, you can inspect the processor model and instruction capabilities using PowerShell or core system utilities.
Querying Processor Model with PowerShell
Open PowerShell and run the following command to retrieve the exact processor name, manufacturer, and clock speed:
Get-CimInstance -ClassName Win32_Processor | Select-Object Name, Manufacturer, Caption, MaxClockSpeed, NumberOfCores, NumberOfLogicalProcessorsVerifying Instruction Set Flags on Windows
Windows does not expose a single flat text list of all CPUID flags
via WMI, but you can query specific instruction set support using the
[System.Environment] API,
IsProcessorFeaturePresent Win32 API, or Sysinternals
Coreinfo.
For a full breakdown of every CPUID flag (such as SSE4.2, AVX2, AVX-512, AES, and SHA), download and run Sysinternals Coreinfo from an elevated Command Prompt or PowerShell window:
.\Coreinfo64.exe -fAn asterisk (*) next to a feature indicates that the
instruction set is supported and enabled on your EC2 instance, while a
hyphen (-) indicates that it is not available.
Alternatively, you can check specific processor features natively in
PowerShell by invoking the Windows kernel API
IsProcessorFeaturePresent:
Add-Type -MemberDefinition @'
[DllImport("kernel32.dll")]
public static extern bool IsProcessorFeaturePresent(uint ProcessorFeature);
'@ -Name "Kernel32" -Namespace "Win32"
# Feature codes: 10 = SSE2, 38 = AVX, 39 = AVX2, 40 = AVX512F
[Win32.Kernel32]::IsProcessorFeaturePresent(39)Identifying Compiler Optimization Targets
If your goal in checking the CPU model and flags is to compile software optimized for the exact EC2 host processor, GCC and Clang can automatically detect the virtualized host CPU architecture and flags:
gcc -march=native -Q --help=target | grep -E "^\s+-march=|^\s+-mtune="This command reveals the internal architecture codename (such as
icelake-server, sapphirerapids,
znver3, or neoverse-v1) and the exact
instruction set flags that the compiler enables on that specific EC2
instance.