Deploying Trains Server: AWS EC2 AMIs

Deployment of the Trains Server on AWS is easily performed using AWS AMIs which are available in the AWS Marketplace catalog and in the AWS community AMI catalog.

After deploying either type of AMI, you can configure your Trains Server instance to provide the authentication scheme that best matches your workflow.

Launching

Securing deployment

By default, Trains Server deploys as an open network. To restrict Trains Server access, follow the instructions in the Network and security section, on the "Configuring Trains Server" page.

The minimum recommended amount of RAM is 8 GB. For example, a t3.large or t3a.large EC2 instance type would accommodate the recommended RAM size.

AWS community AMIs

To launch a Trains Server AWS community AMI, refer to either:

AWS Marketplace AMIs

Launch a Trains Server AWS Marketplace AMI through the AWS Marketplace website.

To launch a Trains Server AWS Marketplace AMI:

  1. Open the AWS Marketplace for the Allegro AI Trains Server.
  2. In the heading area, click Continue to Subscribe.
  3. On the Subscribe to software page, click Accept Terms, and then click Continue to Configuration.
  4. On the Configure this software page, complete the following:

    1. In the Fulfillment Option list, select 64-bit (x86) Amazon Machine Image (AMI).
    2. In the Software Version list, select your Trains Server version. For example, 0.13.0 (Mar 02, 2020).
    3. In the Region list, select your region.
    4. Click Continue to Launch.
  5. On the Launch this software page, in the Choose Action list, select either of following options, and perform the steps for that option:

    • Launch through EC2:

      1. Click Launch.
      2. Follow the instructions on the How do I launch an EC2 instance from a custom Amazon Machine Image (AMI)? AWS documentation page.
    • Launch from Website:

      1. Select your required settings: EC2 Instance Type, VPC Settings, Subnet Settings, Security Group Settings, and Key Pair Settings.
      2. Click Launch.
      3. On the Launch this software page, note your Instance ID. You can use it later to search for your instance in the EC2 Console.

Accessing Trains Server

Once deployed, Trains Server exposes the following services:

  • Web server on TCP port 8080
  • API server on TCP port 8008
  • File Server on TCP port 8081

To locate your Trains Server address:

  1. Go to your AWS EC2 Console.
  2. In the Details tab, Public DNS (IPv4) shows your Trains Server address.

To access Trains Server Web-App (UI):

  • Direct your browser to its web server URL: http://<Server Address>:8080

To SSH into Trains Server:

  • Log into the AWS AMI using the default user name ec2-user. Control the SSH credentials from the AWS management console.

Logging in to the Web-App (UI)

To log in to the Trains Web-App (UI):

  • If you launched Trains Server from an AWS Community AMI, enter any name.
  • If you launched Trains Server through the AWS Marketplace, enter the preconfigured default login credentials, which are:

    • trains-user (the default user name).
    • The Trains Server EC2 instance ID (the default password).

You can modify the default login behavior to match your workflow policy, see Configuring Web Login Authentication on the "Configuring Trains Server" page.

Storage configuration

The pre-built Trains Server storage configuration is the following:

  • MongoDB: /opt/trains/data/mongo/
  • Elasticsearch: /opt/trains/data/elastic_7/
  • File Server: /mnt/fileserver/

Upgrading

Upgrading on the same AWS instance

This section contains the steps to upgrade Trains Server on the same AWS instance.

Your upgrade may be automatic, depending upon the type of Trains Server AMI you are using. The steps in this section provide a detailed explanation.

To upgrade your Trains Server AWS AMI:

  1. If you are using (a) the AWS Marketplace Trains Server 0.13.0 AMI, or (b) one of the auto-update versions of our AWS community Trains Server AMIs (see our list of AMIs), then do the following:

    1. If you are upgrading from Trains Server version 0.15 or older, a data migration is required before you upgrade. First follow these data migration instructions, and then continue this upgrade.
    2. Restart Trains Server, the upgrade is automatic. No further steps are required.
  2. If you are not using an auto-update Trains Server AMI (see the previous step), then do the following:

    1. Shutdown Trains Server. Executing the following command (which assumes the configuration file is in the environment path).

      docker-compose down
      
    2. If you are upgrading Trains Server version 0.15 or older, a data migration is required before you upgrade. First follow these data migration instructions, and then continue this upgrade.

    3. We recommend backing up your data and, if your configuration folder is not empty, backing up your configuration.

    4. Download the latest docker-compose.yml file. Execute the following command:

      sudo curl https://raw.githubusercontent.com/allegroai/trains-server/master/docker-compose.yml -o /opt/trains/docker-compose.yml
      
    5. Startup Trains Server. This automatically pulls the latest Trains Server build.

      docker-compose -f /opt/trains/docker-compose.yml pull
      docker-compose -f docker-compose.yml up -d
      

Upgrading and migrating to a new AWS instance

This section contains the steps to upgrade Trains Server on the new AWS instance.

Your upgrade may be automatic, depending upon the type of Trains Server AMI you are using. The steps in this section provide a detailed explanation.

To migrate and upgrade your Trains Server AWS AMI:

  1. On the old AWS instance, backup your data and, if your configuration folder is not empty, backup your configuration.

  2. If you are using (a) the AWS Marketplace Trains Server 0.13.0 AMI, or (b) one of the auto-update versions of our AWS community Trains Server AMIs (see our list of AMIs), then do the following:

    1. Shutdown Trains Server. Executing the following command (which assumes the configuration file is in the environment path).

      docker-compose down
      
    2. If you are upgrading Trains Server version 0.15 or older, a data migration is required before you upgrade. First follow these data migration instructions, and then continue this upgrade.

    3. On the new AWS instance, restore your data and, if your configuration folder is not empty, restore your configuration.

    4. Restart Trains Server, the upgrade is automatic. No further steps are required.

  3. If you are not using an auto-update Trains Server (see the previous step), then do the following:

    1. Shutdown Trains Server. Executing the following command (which assumes the configuration file is in the environment path).

      docker-compose down
      
    2. If you are upgrading Trains Server version 0.15 or older, a data migration is required before you upgrade. First follow these data migration instructions, and then continue this upgrade.

    3. On the new AWS instance, restore your data and, if your configuration folder is not empty, restore your configuration.

    4. Startup Trains Server. This automatically pulls the latest Trains Server build.

      docker-compose -f docker-compose.yml pull
      docker-compose -f docker-compose.yml up -d
      

Backing up and restoring data and configuration

The commands in this section are examples for backing up and restoring your data and configuration.

If your data and configuration folders are in /opt/trains, then archive all data into ~/trains_backup_data.tgz, and your configuration into ~/trains_backup_config.tgz:

sudo tar czvf ~/trains_backup_data.tgz -C /opt/trains/data .
sudo tar czvf ~/trains_backup_config.tgz -C /opt/trains/config .

If you need to restore your data and configuration:

  1. Verify you have the backup files.
  2. Execute the following commands:
    sudo rm -fR /opt/trains/data/* /opt/trains/config/*
    sudo tar -xzf ~/trains_backup_data.tgz -C /opt/trains/data
    sudo tar -xzf ~/trains_backup_config.tgz -C /opt/trains/config
    

Trains Server AWS community AMIs

The following sections contain lists of AMI Image IDs, per region, for each released Trains Server version.

Latest version

v0.16.1 (auto update)

  • eu-north-1 : ami-0f890ce32e31a385f
  • ap-south-1 : ami-08ecb19100861c72f
  • eu-west-3 : ami-059f4d25851aa6cdf
  • eu-west-2 : ami-0674be7a5cf126c4f
  • eu-west-1 : ami-0856e77cc1c7d0f93
  • ap-northeast-2 : ami-0a6ad4892911a2994
  • ap-northeast-1 : ami-08a005dc3de888837
  • sa-east-1 : ami-00013562656151212
  • ca-central-1 : ami-037715ae453ce7323
  • ap-southeast-1 : ami-0a64f0953a8cce097
  • ap-southeast-2 : ami-0c5c790d742c9d0d1
  • eu-central-1 : ami-04b347e28a18a79cd
  • us-east-2 : ami-0dde84a9b1fe6e9ea
  • us-west-1 : ami-0cbceb547c8ae4d99
  • us-west-2 : ami-0e1d4a3e83ab629dd
  • us-east-1 : ami-0dd594ba64f423eeb

v0.16.1 (static - no auto update)

  • eu-north-1 : ami-0dcb52cfca220f2b3
  • ap-south-1 : ami-0787072da91a17f62
  • eu-west-3 : ami-034f757aabb262ac2
  • eu-west-2 : ami-0768f1ee74217191c
  • eu-west-1 : ami-0b41033a24b4bca43
  • ap-northeast-2 : ami-07d4993d1deec1cc4
  • ap-northeast-1 : ami-0dcab95ca6fb81566
  • sa-east-1 : ami-0ae708dde62bc7c5b
  • ca-central-1 : ami-0df27c53a9b81937c
  • ap-southeast-1 : ami-0fcbd1e98e84c630e
  • ap-southeast-2 : ami-08c28587fb3ef7443
  • eu-central-1 : ami-09c85693049d83dd9
  • us-east-2 : ami-07647269aeb5d0632
  • us-west-1 : ami-0979cf67805cc3f2f
  • us-west-2 : ami-03895b3ad8aa3a607
  • us-east-1 : ami-0363a7f2bb062767c

v0.16.0 (static - no auto update)

  • eu-north-1 : ami-0d6f44a1a7145a9f8
  • ap-south-1 : ami-08eface916bf157b9
  • eu-west-3 : ami-074ba328cb6189779
  • eu-west-2 : ami-0f3d655eb6cffb435
  • eu-west-1 : ami-044f904039d9bed9b
  • ap-northeast-2 : ami-0b918a6e78336dbab
  • ap-northeast-1 : ami-0cfab3e433251deb9
  • sa-east-1 : ami-042328da7c44290ea
  • ca-central-1 : ami-0b0f85c4dbbda1243
  • ap-southeast-1 : ami-078758adc8e1bb47b
  • ap-southeast-2 : ami-055a4b30c58198b28
  • eu-central-1 : ami-089a06c5a9a03ddd4
  • us-east-2 : ami-0f69b4648f107f50e
  • us-west-1 : ami-0056ffc50002f6214
  • us-west-2 : ami-081f429c43980655e
  • us-east-1 : ami-0ee7965a15d972d96

v0.15.1 (static - no auto update)

  • eu-north-1 : ami-0cd314e267426d1b7
  • ap-south-1 : ami-086182cbe29151f96
  • eu-west-3 : ami-0062366012182815b
  • eu-west-2 : ami-022b8f2e32a9d18d0
  • eu-west-1 : ami-0d8cf60446e09aa3d
  • ap-northeast-2 : ami-0d4c168a815b56889
  • ap-northeast-1 : ami-0daf7887db1053ae4
  • sa-east-1 : ami-020a759a3ba4ff22b
  • ca-central-1 : ami-0c10b5e04b707f3e3
  • ap-southeast-1 : ami-0f61bb3529a165fcd
  • ap-southeast-2 : ami-032dcdc82749c66c5
  • eu-central-1 : ami-08f364f32d2eb3bae
  • us-east-2 : ami-0b7efc3591803eba4
  • us-west-1 : ami-08b2df27b0ada6faf
  • us-west-2 : ami-0693029c4bad28816
  • us-east-1 : ami-0200954fa9c2819ff

v0.15.0 (static - no auto update)

  • eu-north-1 : ami-0bef15c03eab64c0c
  • ap-south-1 : ami-06ac6248e583e2cd2
  • eu-west-3 : ami-0541d86ef47a5714e
  • eu-west-2 : ami-01381ef4c4ed22482
  • eu-west-1 : ami-064626a0dd38b21f1
  • ap-northeast-2 : ami-0a2490a7a3a8aa675
  • ap-northeast-1 : ami-063f1de819a2524b8
  • sa-east-1 : ami-07980486741b94987
  • ca-central-1 : ami-0ced3b8b21ded839e
  • ap-southeast-1 : ami-0c493c5093fde8741
  • ap-southeast-2 : ami-0320a727eccb8dc6c
  • eu-central-1 : ami-0aa85cfc78674c526
  • us-east-2 : ami-01791485051e1880c
  • us-west-1 : ami-0d8eade4d5888ea73
  • us-west-2 : ami-02ceaef72cdf60f7e
  • us-east-1 : ami-0fc3f9d1d0eba1d62

v0.14.1 (static - no auto update)

  • eu-north-1 : ami-036defe1885dced2e
  • ap-south-1 : ami-0b403aa1da6a5dc17
  • eu-west-3 : ami-0d30c2d330d1255c4
  • eu-west-2 : ami-06f0e8d075e50a029
  • eu-west-1 : ami-0da721d874f282b6d
  • ap-northeast-2 : ami-03bffe94675dd5f8c
  • ap-northeast-1 : ami-0f96520d646423673
  • sa-east-1 : ami-0c2f706a3b7d97282
  • ca-central-1 : ami-0da74525dcfd74e32
  • ap-southeast-1 : ami-066368a21cf6d232b
  • ap-southeast-2 : ami-0bfd09170067f7318
  • eu-central-1 : ami-06aa99b1c41492986
  • us-east-2 : ami-065c1880f59d03272
  • us-west-1 : ami-0b7f6b896f5058eba
  • us-west-2 : ami-0041e10ca68eef29a
  • us-east-1 : ami-0b7125e4305bbd7eb

v0.14.0 (static - no auto update)

  • eu-north-1 : ami-02de71586ec496e38
  • ap-south-1 : ami-074b03849b51852e5
  • eu-west-3 : ami-022c388835e0eeb03
  • eu-west-2 : ami-0a151c236c6b27707
  • eu-west-1 : ami-06de69b06b4e73312
  • ap-northeast-2 : ami-0ee821b72d9f669b1
  • ap-northeast-1 : ami-03687ae215e64e100
  • sa-east-1 : ami-01eb83364b7f667af
  • ca-central-1 : ami-02e9b35f9c90377e6
  • ap-southeast-1 : ami-0d3ab5ab0048fea51
  • ap-southeast-2 : ami-0bd39d908fe3a9e06
  • eu-central-1 : ami-0b8638701311b35c4
  • us-east-2 : ami-02ff039693fc3a614
  • us-west-1 : ami-08634f7dfb608a9a7
  • us-west-2 : ami-034d693ef742b9333
  • us-east-1 : ami-0b828b05c323dde7f

v0.13.0 (static - no auto update)

  • eu-north-1 : ami-0d9c74a015e7510d8
  • ap-south-1 : ami-02acd6dd0659bb5c1
  • eu-west-3 : ami-0f0cc5cb6d9afd194
  • eu-west-2 : ami-0298fdc0860206ed9
  • eu-west-1 : ami-0cdc072e528401d5e
  • ap-northeast-2 : ami-0055579cc95b0e53e
  • ap-northeast-1 : ami-0ced7becb9b83b5d0
  • sa-east-1 : ami-033345d0f16a1b5e4
  • ca-central-1 : ami-06c63b05aed47ae67
  • ap-southeast-1 : ami-09f0355f367f30602
  • ap-southeast-2 : ami-0bd2314163ce0fba0
  • eu-central-1 : ami-05fbae957df63e366
  • us-east-2 : ami-050c51b5b4074d3fc
  • us-west-1 : ami-06ad513073d4e5a19
  • us-west-2 : ami-0c96e1361d1d4ca94
  • us-east-1 : ami-07b669040d1eea213

v0.12.1 (static - no auto update)

  • eu-north-1 : ami-003118a8103286d84
  • ap-south-1 : ami-02dfe86baa48e096f
  • eu-west-3 : ami-0cc1f01267d2a780d
  • eu-west-2 : ami-0e4c8332e5ce09585
  • eu-west-1 : ami-03459a2f0b0a3b1ab
  • ap-northeast-2 : ami-08f6c2aed3a53f24c
  • ap-northeast-1 : ami-0b798eab95a7c5435
  • sa-east-1 : ami-0d3ee166c09f0d1b2
  • ca-central-1 : ami-00a758c56bd63acd5
  • ap-southeast-1 : ami-0be64d4988cd03fbb
  • ap-southeast-2 : ami-02087310d43a63f31
  • eu-central-1 : ami-097bbefeac0c74225
  • us-east-2 : ami-07eda256712b90f4d
  • us-west-1 : ami-02ef2b55cbd01c7df
  • us-west-2 : ami-037c6176ef4735360
  • us-east-1 : ami-08715c20c0e3f1c15

v0.12.0 (static - no auto update)

  • eu-north-1 : ami-03ff8ab48cd43e77e
  • ap-south-1 : ami-079c1a41ff836487c
  • eu-west-3 : ami-0121ef0398ae87ab0
  • eu-west-2 : ami-09f0f97654d8c79de
  • eu-west-1 : ami-0b7ba303f757bfcd9
  • ap-northeast-2 : ami-053f416517b5f40a6
  • ap-northeast-1 : ami-056dff06c698c2d9d
  • sa-east-1 : ami-017ab655119258639
  • ca-central-1 : ami-03bf5fa1d86ac97f6
  • ap-southeast-1 : ami-0e667958002b0360c
  • ap-southeast-2 : ami-091f1b69cb43b1933
  • eu-central-1 : ami-068ec2f0e98c26541
  • us-east-2 : ami-0524bbdc1b64ff83f
  • us-west-1 : ami-0b4facd7534e393c9
  • us-west-2 : ami-0018d5a7e58966848
  • us-east-1 : ami-08f24178fc14a84d2

v0.11.0 (static - no auto update)

  • eu-north-1 : ami-0cbe338f058018c97
  • ap-south-1 : ami-06d72ff894f7a5e5d
  • eu-west-3 : ami-00f2a45d67df2d2f3
  • eu-west-2 : ami-0627ae688f4533237
  • eu-west-1 : ami-00bf924ccb0354418
  • ap-northeast-2 : ami-0800edf1d1dec1da8
  • ap-northeast-1 : ami-07b2ed9709cdc4b15
  • sa-east-1 : ami-0012c1648618b812c
  • ca-central-1 : ami-02870b965d002fc8a
  • ap-southeast-1 : ami-068ec23abf2473192
  • ap-southeast-2 : ami-06664624728b5e01a
  • eu-central-1 : ami-05f2a9304f237a6f0
  • us-east-2 : ami-0ec242e6dca2b72b9
  • us-west-1 : ami-050b6577acf246ceb
  • us-west-2 : ami-0e384b6f78bf96ebe
  • us-east-1 : ami-0a7b46f907d5d9c4a

v0.10.1 (static - no auto update)

  • eu-north-1 : ami-09937ec4d18350c32
  • ap-south-1 : ami-089d6ba7541ec4c7f
  • eu-west-3 : ami-0accb1a94bdd5c5c1
  • eu-west-2 : ami-0dd2c97bc678b8570
  • eu-west-1 : ami-07a38865cbe7ca3cb
  • ap-northeast-2 : ami-09aa0b7fe1cf3dd55
  • ap-northeast-1 : ami-0905e7d1543e5ed36
  • sa-east-1 : ami-08c0627daa67d7372
  • ca-central-1 : ami-034add081712ff648
  • ap-southeast-1 : ami-0c6caee3689b6e066
  • ap-southeast-2 : ami-04994afd8dae5b417
  • eu-central-1 : ami-06b10f8c30e1434f1
  • us-east-2 : ami-0d3abe7a1fec535cc
  • us-west-1 : ami-02bb610b70c55018b
  • us-west-2 : ami-0d1cb8ba7de246ff0
  • us-east-1 : ami-049ccba6abdb40cba

v0.10.0 (static - no auto update)

  • eu-north-1 : ami-05ba33c763877e54e
  • ap-south-1 : ami-0529eec569161cae5
  • eu-west-3 : ami-03cb9396f63e26ff6
  • eu-west-2 : ami-0dd28cc97283cc201
  • eu-west-1 : ami-059cf379ae14b0a24
  • ap-northeast-2 : ami-031409d71f1280616
  • ap-northeast-1 : ami-0171437c68b3660aa
  • sa-east-1 : ami-0eb440a3b6e591c7a
  • ca-central-1 : ami-097da9ec155ee654a
  • ap-southeast-1 : ami-0ab7ff3ea09826e39
  • ap-southeast-2 : ami-00969c550ef2d1f60
  • eu-central-1 : ami-02246400c51990acb
  • us-east-2 : ami-0cafc1d730381d6fa
  • eu-central-1 : ami-02246400c51990acb
  • us-west-1 : ami-0e82a98ddbe995a65
  • us-west-2 : ami-04a522ecb2250fb44
  • us-east-1 : ami-0a66ddbd50959f91e

v0.9.0 (static - no auto update)

  • us-east-1 : ami-0991ad536ecbacdac
  • eu-north-1 : ami-07cbcdff501b14afe
  • ap-south-1 : ami-014cf398b00d4db83
  • eu-west-3 : ami-0396ba51e9b733581
  • eu-west-2 : ami-09134f4c7a20bad09
  • eu-west-1 : ami-00427ed0a1bbfa7b0
  • ap-northeast-2 : ami-041756675ca1be954
  • ap-northeast-1 : ami-0c09ebad05c9128ff
  • sa-east-1 : ami-017a8de4e8d1e8c8e
  • ca-central-1 : ami-049ec444470f852be
  • ap-southeast-1 : ami-0c919b8f821a6c635
  • ap-southeast-2 : ami-04844a0594712d27b
  • eu-central-1 : ami-0b4e756e0f7c0617d
  • us-east-2 : ami-03b01914b07428488
  • us-west-1 : ami-0cf4768e9d47ed076
  • us-west-2 : ami-0b145f37da31eb9fb

Next Step