Profiling Applications in Amazon Web Services* (AWS) EC2 Instances
This recipe helps you set up a VM instance in AWS for performance profiling with
Intel® VTune™
.
Profiler
Ingredients
This section lists the hardware and software tools used for the performance analysis scenario.
- Application:matrix. The application is used as a demo and not available for download.
- Tools:Intel® VTune™2020 - Hotspots analysisProfiler
- Starting with the 2020 release, Intel® VTune™ Amplifier has been renamed toIntel® VTune™.Profiler
- Most recipes in theIntel® VTune™Performance Analysis Cookbook are flexible. You can apply them to different versions ofProfilerIntel® VTune™. In some cases, minor adjustments may be required.Profiler
- Get the latest version ofIntel® VTune™:Profiler
- From theIntel® VTune™product page.Profiler
- Download the latest standalone package from the Intel® oneAPI standalone components page.
Create and Configure a Virtual Machine Instance
- On the Amazon Web Services site, clickSign In to the Consoleto log in to your account.If you do not have an account, create it.
- Enter the Amazon EC2 Dashboard, selectCompute > EC2.
- ClickLaunch Instanceto create and configure your virtual machine with a wizard.In the configuration wizard, you can specify an OS and specification of the instance that fits your case (number of CPUs, memory, storage, and networking capacity).
- InStep 1: Choose an Amazon Machine Image (AMI), select Ubuntu Server 18.04 LTSlick.
- InStep 2: Choose an Instance Type, select an instance and clickNext: Configure Instance Details.Recommended system requirements for theVTuneis 4 GB of RAM and at least 10Gb free disk space.Profiler
- InStep 3: Configure Instance Details, enableAuto-assign Public IPand clickNext: Add Storage.
- InStep 4: Add Storage, increase the size of the storage device and clickNext: Add Tags.
- [Optional] InStep 5: Add Tags, add a tag (for example,VTune Demo), then clickReview and Launch.
- InStep 7: Review Instance Launch, clickLaunch.
- Create a key pair:
- SelectCreate a new key pairand assign a name (for example, MyEC2Instance).
- ClickDownload Key Pairto download the key.
- SelectLaunch Instancesto complete the setup.The instance is launched.
- ClickView Instances.When theInstance Stateis updated torunning, proceed to the next step.
Connect to the EC 2 Instance
Select the EC2 instance you created and click the
Connect
tab to connect to your instance via SSH.

PuTTY* does not natively support the private key format (
.pem
) generated by Amazon EC2. You should convert your private key (.pem
) to the required PuTTY format (.ppk
) using PuTTYgen before attempting to connect to your instance using PuTTY:
- Convert your private key:
- Start PuTTYgen.
- For theType of key to generate, selectSSH-1 (RSA).
- ClickLoadand select your.pemfile.
- ClickSave private keyto save the key in the format that PuTTY can use.
- Start PuTTY and specify a Public DNS for the instance and your private key (.ppk) file in theConnection > SSH > Authpane.
- Save this configuration and clickOpen.You are logged in to the instance.
You need to install the Xubuntu* desktop on your running instance and setup a VNC* Server if you want to access the system via VNC.
Configure the Instance for Profiling
Prepare the target instance for profiling by setting
/proc/sys/kernel/yama/ptrace_scope
to 0:
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
Run Hotspots Analysis
Run the Hotspots analysis using any of the following methods:
Run a remote collection from the locally installed
VTune
using SSH: Profiler
Remote hardware event-based sampling analysis is not available in the AWS EC2 virtualized environment with an exception for the EC2 bare metal instances (i3.metal instance family) that allow direct access to bare metal infrastructure and full profiling capability of the
VTune
.
Profiler
- Create a project in theVTune.ProfilerTheConfigure Analysiswindow opens.
- In theWHEREpane, selectRemote Linux (SSH)and enterubuntu@<for thename of putty configuration>SSH destination.At this point,VTuneattempts to connect to the remote system and install the binaries necessary for collection to the specified folder.Profiler
- In theWHATpane, specify the location of your application and its working directory.
- In theHOWpane, select theUser-Mode Samplingcollection mode for the Hotspots analysis (open by default).
- Click
to start the collection.
The results are automatically copied to your local system for analysis.
Run
VTune
directly from the AWS instance: Profiler
- Install theVTuneas described in the Installation Guide.Profiler
- Run theVTune. For example:Profilersudo <vtune_install_dir>/vtune_profiler/bin64/vtune-gui
- Create a project.TheConfigure Analysiswindow opens.
- In theWHEREpane, selectLocal Host.
- In theWHATpane, specify the location of your application and its working directory.
- In theHOWpane, select a preferred collection mode for the Hotspots analysis, for example:Hardware Event-Based Sampling.
- Click
to start the collection.
The analysis result opens in the default Hotspots by CPU Utilization viewpoint.