Deep Learning AMI
Developer Guide


TensorBoard lets you to visually inspect and interpret your TensorFlow runs and graphs. It runs a web server that serves a webpage for viewing and interacting with the TensorBoard visualizations.

TensorFlow and TensorBoard are preinstalled with the Deep Learning AMI with Conda (DLAMI with Conda). The DLAMI with Conda also includes an example script that uses TensorFlow to train an MNIST model with extra logging features enabled. MNIST is a database of handwritten numbers that is commonly used to train image recognition models. In this tutorial, you use the script to train an MNIST model, and TensorBoard and the logs to create visualizations.

Train an MNIST Model and Visualize the Training with TensorBoard

Visualize MNIST model training with TensorBoard

  1. Connect to your Amazon Elastic Compute Cloud (Amazon EC2) instance of the DLAMI with Conda.

  2. Activate the Python 2.7 TensorFlow environment and navigate to the directory that contains the folder with the TensorBoard example scripts:

    $ source activate tensorflow_p27 $ cd ~/tutorials/TensorFlow/board
  3. Run the script that trains an MNIST model with extended logging enabled:

    $ python

    The script writes the logs to /tmp/tensorflow/mnist.

  4. Pass the location of the logs to tensorboard:

    $ tensorboard --logdir=/tmp/tensorflow/mnist

    TensorBoard launches the visualization web server on port 6006.

  5. For easy access from your local browser, you can change the web server port to port 80 or another port. Whichever port you use, you will need to open this port in the EC2 security group for your DLAMI. You can also use port forwarding. For instructions on changing your security group settings and port forwarding, see Set up a Jupyter Notebook Server. The default settings are described in the next step.


    If you need to run both Jupyter server and a TensorBoard server, use a different port for each.

  6. Open port 6006 (or the port you assigned to the visualization web server) on your EC2 instance.

    1. Open your EC2 instance in the Amazon EC2console at

    2. In the Amazon EC2 console, choose Network & Security, then chooseSecurity Groups.

    3. For Security Group, , choose the one that was created most recently (see the time stamp in the description).

    4. Choose the Inbound tab, and choose Edit.

    5. Choose Add Rule.

    6. In the new row, type the followings:

      Type : Custom TCP Rule

      Protocol: TCP

      Port Range: 6006 (or the port that you assigned to the visualization server)

      Source: Anywhere (,::/0)

  7. Open the web page for the TensorBoard visualizations by using the public IP or DNS address of the EC2 instance that's running the DLAMI with Conda and the port that you opened for TensorBoard:

    http:// YourInstancePublicDNS:6006

More Info

To learn more about TensorBoard, see the TensorBoard website.