Menu
Apache MXNet on AWS
Developer Guide

Configure a Windows Client

To connect your Windows client to the Jupyter server, do the following:

  • Configure proxy settings

    Configure your Internet browser to use an add-on, such as FoxyProxy, to manage your Socket Secure (SOCKS) proxy settings. The proxy management add-on enables you to limit the proxy settings to domains that match the form of the public DNS name of your EC2 instance. The add-on automatically handles turning the proxy on and off when you switch between viewing websites hosted on the EC2 instance and those on the Internet.

  • Set up an SSH tunnel to your EC2 instance

    This is also known as port forwarding. If you create the tunnel using dynamic port forwarding, all traffic that is routed to a specified unused local port is forwarded to the Jupyter server on the EC2 instance. This creates a SOCKS proxy.

Step 1: Prepare

Make sure you have the following information, which you need to set up the SSH tunnel:

  • The public DNS name of your EC2 instance. You can find the public DNS name in the EC2 console. If you set up a cluster of EC2 instances, see Set Up a Stack for Distributed Deep Learning Using Apache MXNet ) for information about finding the public DNS name of the master node.

  • The key pair for the private key file. For more information about accessing your key pair, see Amazon EC2 Key Pairs in the Amazon EC2 User Guide for Linux Instances.

Step 2: Configure Browser Proxy Settings

Configure the client browser to use FoxyProxy to manage SOCKS proxy settings. We provide procedures for both Firefox and Chrome.

Option 1: Configure proxy settings for Firefox

  1. Download and install the Standard version of FoxyProxy from http://getfoxyproxy.org/downloads.html.

  2. Using a text editor, create a file named foxyproxy-settings.xml. Save the following to the file:

    Copy
    <?xml version="1.0" encoding="UTF-8"?> <foxyproxy> <proxies> <proxy name="ec2-socks-proxy" id="2322596116" notes="" fromSubscription="false" enabled="true" mode="manual" selectedTabIndex="2" lastresort="false" animatedIcons="true" includeInCycle="true" color="#0055E5" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="false" disableCache="false" clearCookiesBeforeUse="false" rejectCookies="false"> <matches> <match enabled="true" name="*ec2*.amazonaws.com*" pattern="*ec2*.amazonaws.com*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false" /> <match enabled="true" name="*ec2*.compute*" pattern="*ec2*.compute*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false" /> <match enabled="true" name="*.compute.internal*" pattern="*.compute.internal*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/> <match enabled="true" name="*.ec2.internal* " pattern="*.ec2.internal*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/> </matches> <manualconf host="localhost" port="8157" socksversion="5" isSocks="true" username="" password="" domain="" /> </proxy> </proxies> </foxyproxy>

    You use this settings file in the next step when configuring FoxyProxy. The settings do the following:

    • Port 8157 is the local port number used to establish the SSH tunnel with the Jupyter server. This must match the port number you used in PuTTY or the terminal.

    • The *ec2*.amazonaws.com* pattern matches the public DNS name of clusters in AWS US Regions.

    • The *ec2*.compute* pattern matches the public DNS name of clusters in all other AWS Regions.

  3. Configure FoxyProxy.

    1. In Firefox, choose Add-ons.

    2. On the add-ons page, choose Extensions.

    3. Next to FoxyProxy Standard, choose Options.

    4. In the FoxyProxy Standard dialog box, do the following.

      1. Import the settings file.

        Choose File, choose Import Settings, and then open the foxyproxy-settings.xml file that you saved in the preceding step. If you are prompted to overwrite the settings, do so, and then restart Firefox.

      2. Choose Select Mode, and then choose Use proxies based on their pre-defined patterns and priorities.

      3. After Firefox restarts, in the FoxyProxy Standard dialog box, verify that Select Mode is set to Use proxies based on their pre-defined patterns and priorities.

    5. If the installation and configuration is successful, you see the FoxyProxy icon next to the URL address bar in the browser.

Option 2: Configure proxy settings for Chrome

  1. Download and install the Standard version of FoxyProxy from http://getfoxyproxy.org/downloads.html.

  2. Using a text editor, create a file named foxyproxy-settings.xml. Save the following to the file:

    Copy
    <?xml version="1.0" encoding="UTF-8"?> <foxyproxy> <proxies> <proxy name="ec2-socks-proxy" id="2322596116" notes="" fromSubscription="false" enabled="true" mode="manual" selectedTabIndex="2" lastresort="false" animatedIcons="true" includeInCycle="true" color="#0055E5" proxyDNS="true" noInternalIPs="false" autoconfMode="pac" clearCacheBeforeUse="false" disableCache="false" clearCookiesBeforeUse="false" rejectCookies="false"> <matches> <match enabled="true" name="*ec2*.amazonaws.com*" pattern="*ec2*.amazonaws.com*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false" /> <match enabled="true" name="*ec2*.compute*" pattern="*ec2*.compute*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false" /> <match enabled="true" name="*.compute.internal*" pattern="*.compute.internal*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/> <match enabled="true" name="*.ec2.internal* " pattern="*.ec2.internal*" isRegEx="false" isBlackList="false" isMultiLine="false" caseSensitive="false" fromSubscription="false"/> </matches> <manualconf host="localhost" port="8157" socksversion="5" isSocks="true" username="" password="" domain="" /> </proxy> </proxies> </foxyproxy>

    You use these settings file in the next step when configuring FoxyProxy. The settings do the following:

    • Port 8157 is the local port number used to establish the SSH tunnel with the Jupyter server. This must match the port number you used in PuTTY or in the terminal.

    • The *ec2*.amazonaws.com* pattern matches the public DNS name of clusters in AWS US Regions.

    • The *ec2*.compute* pattern matches the public DNS name of clusters in all other AWS Regions.

  3. Configure FoxyProxy.

    1. Choose Customize and Control Google Chrome, choose Tools (or More Tools), and then choose Extensions.

    2. Next to FoxyProxy Standard, choose Options.

    3. Choose Extensions, choose Options, and then do the following.

      1. Import the settings file.

        On the Import/Export page, choose Choose File, and then open the foxyproxy-settings.xml file that you saved in the preceding step. If you are prompted to overwrite the settings, do so.

      2. Choose Proxy mode, and then choose Use proxies based on their predefined patterns and priorities.

    4. If the installation and configuration is successful, you see the FoxyProxy icon next to the URL address bar in the browser.

Step 3: Set Up an SSH Tunnel to Your EC2 Instance on the Client

Your client uses an SSH tunnel to your EC2 instance for dynamic port forwarding. For Windows, we use a PuTTY SSH client. First download and install PuTTY and PuTTYgen tools. For more information, see PuTTY download page.

Note

You need both the PuTTY and PuTTYgen tools. PuTTY does not natively support the key-pair private key file format (.pem) generated by Amazon Elastic Compute Cloud (Amazon EC2). You use PuTTYgen to convert your key file to the required PuTTY format (.ppk). Convert your key into this format (.ppk) before attempting to connect to the master node using PuTTY. For more information about converting your key, see Connecting to Your Linux Instance from Windows Using PuTTY in the Amazon EC2 User Guide for Linux Instances.

Set up an SSH tunnel using dynamic port forwarding on Windows

  1. Start PuTTY by double-clicking putty.exe.

  2. In the Categories section, choose Sessions and for Host Name, type ubuntu@MasterPublicDNS. For example:

    Copy
    ubuntu@ec2-##-###-###-###.compute-1.amazonaws.com
  3. In the Categories section, choose Connection. Choose SSH, and then choose Auth.

  4. For Private key file for authentication, choose Browse, and then choose the .ppk file.

  5. In the Categories section, choose Connection-. Choose SSH, and then choose Tunnels. Configure the tunnel.

    1. For Source port, type 8157 (an unused local port).

    2. Choose Dynamic and Auto.

    3. Choose Add, and then choose Open.

    This opens the tunnel.

  6. Create a directory on the EC2 instance for storing Jupyter notebooks. This is your Jupyter workspace.

    Copy
    $ mkdir ~/mynotebooks $ cd ~/mynotebooks
  7. Start the Jupyter notebook server.

    Copy
    $ jupyter notebook

    By default, the server runs on port 8888. If the port is not available, it uses the next available port. The Jupyter terminal shows the port on which the server is listening.

Next Step

Step 4: Test by Logging in to the Jupyter Server