Your application does not need any credentials to push traces into X-ray. you just need to install the x-ray Daemon on EKS/EC2. This daemon will be responsable to ship the traces to the service on AWS.
On EKS:
arn:aws:iam::aws:policy/AWSXRayDaemonWriteAccess attachedOn your application:
Import the sdk that you will use . for Golang import github.com/aws/aws-xray-sdk-go/
Configure your x-ray
xray.Configure(xray.Config{
DaemonAddr: "your_local_daemon_address",
})
On every request that you want to trace, you just create a the x-ray to the handler
http.Handle("/", xray.Handler(xray.NewFixedSegmentNamer("MyApp"), http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello!"))
})))
That's all . If you need a detailed implementation, i have created a blog post for it : https://medium.com/@ilyesAj/adding-aws-x-ray-tracing-to-your-apps-running-on-eks-55a806f76179
Reference: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-go.html