Re-configuring AWS X-Ray Daemon

0

Hi,

I am deploying AWS X-Ray daemon on an EC2 Instance (AWS Linux AMI). I am doing this by following the instructions provided in https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-ec2.html which asks to have the following in UserData script:

#!/bin/bash
curl https://s3.dualstack.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

The above install launches the X-Ray Daemon and it listens to the default UDP bind address 127.0.0.1:2000 (Loopback address).

I require to make the daemon process listen to the public network (0.0.0.0:3000) and also want changes to the region and logging configuration. https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-configuration.html describes how this can be achieved. But I am facing the following issues:
1.) I am facing problems killing the X-Ray daemon on instance start up through the User Data script. pkill is not working for xray.
2.) I am unsure of how to start X-Ray daemon in the user data script as it is not as straight forward as executing the X-ray command to run in background mode i.e

/usr/bin/xray -c "/home/ec2-user/xray_config/daemon_config.yaml" &

will not work.

I am wondering if it would be possible to specify a configuration file during X-Ray daemon installation so that the default daemon process that kicks off after install is launched with the configuration parameters (UDP bind address etc) that I specify. Can anyone please help me with this?

Regards,

Edited by: shricloud on May 27, 2019 12:41 PM

Edited by: shricloud on May 27, 2019 12:42 PM

asked 5 years ago760 views
1 Answer
0

I found a solution for this after digging into the xray rpm.The xray daemon can be stopped / started using the following commands:

If sbin is installed:
To stop: /sbin/stop xray 
To Start: /sbin/start xray
If systemctl is installed:
To stop: 
systemctl stop xray
systemctl daemon-reload

To start:
systemctl start xray 
systemctl daemon-reload

So I achieved reconfiguration of X-ray daemon in cloud formation user script as follows:
/sbin/stop xray
mv /home/ec2-user/xray_config/daemon_config.yaml /etc/amazon/xray/cfg.yaml
/sbin/start xray

Thanks!

answered 5 years 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.

Guidelines for Answering Questions