Using xGT on AWS

The xGT server runs as a Linux daemon on an AWS instance you spin up and listens on a local port for commands. The server is driven by a Python client, which can be run either locally on the AWS instance or any other client by installing the xgt package.

There are three general modes of operation for working with xGT on AWS:

Local to AWS

All Python scripts are run locally within the same AWS instance.

This strategy involves:

SSH tunneling

All Python scripts are run on a remote system such as your laptop or desktop that is connected using an SSH Tunnel.

$ ssh -i <private key file> -N -L 4367:localhost:4367 ec2-user@<instance DNS name or IP address>

Using an open port

Warning: This method is insecure without enabling SSL support.

This is similar to the previous scenario but the EC2 instance has a port opened up for clients to connect. The default port for xgt and the one used on AWS is 4367.

Connecting to a remote server using the xgt package is straightforward:

$ python
>>> import xgt
>>> conn = xgt.Connection("<DNS name or IP address>")

Note that because this mode allows for data between client and server to be sent unencrypted, it is insecure and should really only be used in development. xGT supports SSL authentication for both client and server, which both encrypts all traffic back and forth as well as verifying client and server identities. Enabling SSL requires adding certificate files and restarting the server. More information can be found here: Using an SSL secure channel.

Running the xgtd server daemon

The server component of the xGT application is called xgtd. It is a daemon process launched automatically at boot. You can examine and control the xGT server using standard linux utilities:

sudo systemctl status xgtd
sudo systemctl stop xgtd
sudo systemctl start xgtd
sudo systemctl restart xgtd


When running xgtd using the using the strategy described above, the events are written into a log file named /var/log/xgtd.log.

Data considerations

When using the xgtd:// protocol for reading and writing data, xGT will look for relative pathnames in the /srv/xgtd/data directory. For example, xGT would look for the path xgtd://folder/file in /srv/xgtd/data/folder/file.

To learn more about loading and saving, read the data management guide.