Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Running the X-Ray daemon on Amazon EC2

Focus mode
Running the X-Ray daemon on Amazon EC2 - AWS X-Ray

You can run the X-Ray daemon on the following operating systems on Amazon EC2:

  • Amazon Linux

  • Ubuntu

  • Windows Server (2012 R2 and newer)

Use an instance profile to grant the daemon permission to upload trace data to X-Ray. For more information, see Giving the daemon permission to send data to X-Ray.

Use a user data script to run the daemon automatically when you launch the instance.

Example User data script - Linux
#!/bin/bash curl https://s3.us-east-2.amazonaws.com/aws-xray-assets.us-east-2/xray-daemon/aws-xray-daemon-3.x.rpm -o /home/ec2-user/xray.rpm yum install -y /home/ec2-user/xray.rpm
Example User data script - Windows server
<powershell> if ( Get-Service "AWSXRayDaemon" -ErrorAction SilentlyContinue ) { sc.exe stop AWSXRayDaemon sc.exe delete AWSXRayDaemon } $targetLocation = "C:\Program Files\Amazon\XRay" if ((Test-Path $targetLocation) -eq 0) { mkdir $targetLocation } $zipFileName = "aws-xray-daemon-windows-service-3.x.zip" $zipPath = "$targetLocation\$zipFileName" $destPath = "$targetLocation\aws-xray-daemon" if ((Test-Path $destPath) -eq 1) { Remove-Item -Recurse -Force $destPath } $daemonPath = "$destPath\xray.exe" $daemonLogPath = "$targetLocation\xray-daemon.log" $url = "https://s3.dualstack.us-west-2.amazonaws.com/aws-xray-assets.us-west-2/xray-daemon/aws-xray-daemon-windows-service-3.x.zip" Invoke-WebRequest -Uri $url -OutFile $zipPath Add-Type -Assembly "System.IO.Compression.Filesystem" [io.compression.zipfile]::ExtractToDirectory($zipPath, $destPath) New-Service -Name "AWSXRayDaemon" -StartupType Automatic -BinaryPathName "`"$daemonPath`" -f `"$daemonLogPath`"" sc.exe start AWSXRayDaemon </powershell>
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.