Migration & Modernization

Exporting network configuration data with Import/Export for NSX

Whether it’s VMware Cloud on AWS (VMC-A) or VMware Cloud Foundation (VCF) situated on-premises, Import/Export for NSX is a new AWS Open Source tool that you can use to export your VMware NSX configuration into a zipped file. You can then import the zipfile into Amazon Q Developer transformation capabilities for VMware. Q Developer will convert your NSX configuration to AWS native constructs like VPCs, subnets, and security groups. This blog post walks you through the process of exporting your NSX-T configuration. We have also published an overview blog and a getting started guide for the newly released VMware functionality available in Q Developer.

Import/Export for NSX prerequisites

  1. Python3 – Download and install Python3 on your workstation – version 3.10 or greater is required.
  2. Import/Export for NSX – Available on GitHub
    • Familiar with Git? Clone the repository to your local workstation

      git clone https://github.com/awslabs/import-export-for-nsx.git

      Terminal window showing a git clone command

      Figure 1: Terminal window showing a git clone command

    • Not a Git user? Download the latest release as a ZIP from the releases page, then unzip it on your workstation.
  3. After installing Python3, consider activating Python’s virtual environment. It is not required, but it is a good practice to follow. Using Python’s virtual environment functionality will prevent any libraries used in this program from conflicting with versions already on your workstation. Even if you have no conflicts because you installed Python for the first time today, learning how to work with it might inspire you to use more Python projects. Using virtual environments will make future exploration easier.
    cd import-export-for-nsx
    python3 -m venv .venv
    source .venv/bin/activate
    cd import-export-for-nsx
    python -m venv venv
    .\venv\Scripts\Activate.ps1

    Terminal window showing Python virtual environment commands

    Figure 2: Terminal window showing Python virtual environment commands

  4. Install the required Python libraries.
    pip3 install -r requirements.txt
    python -m pip install -r .\requirements.txt

    Output is truncated in the screenshot, but this is how the installation looks when you run the command:

    Terminal window showing Python library installation

    Figure 3: Terminal window showing Python library installation

IMPORTANT: If you are exporting from VMware Cloud on AWS, read the next section. Skip to the following section if you are exporting from on-prem NSX,

Step 1a – Exporting the NSX configuration from VMware Cloud on AWS

  1. Generate a VMware Cloud on AWS token. The token must have the VMware Cloud on AWS Administrator and VMware Cloud on AWS NSX Cloud Admin roles.
  2. Retrieve the Organization ID and SDDC ID from your VMware Cloud on AWS SDDC. They can be found on the Support tab of your SDDC.
  3. Create environment variables.
    EXP_source_refresh_token="xxxxx"
    export EXP_source_refresh_token
    EXP_source_org_id="xxxxx"
    export EXP_source_org_id
    EXP_source_sddc_id="xxxxx"
    export EXP_source_sddc_id
    $env:EXP_source_refresh_token = "xxxxx"
    $env:EXP_source_org_id = "xxxxx"
    $env:EXP_source_sddc_id = "xxxxx"

Step 1b – Exporting the NSX configuration from on-premises NSX

    1. Locate vmc.ini in the /config_ini folder. Change auth_mode to a value of local and nsx_endpoint_type to a value of nsx.

      Visual Studio Code showing the vmc.ini configuration file

      Figure 4: Visual Studio Code showing the vmc.ini configuration file

    2.  Locate the NSX manager URL. You will also have to input NSX manager credentials into the tool. Unlike VMware Cloud on AWS, you do not have to use an administrative credential to export from on-prem NSX. You can use the read-only NSX audit user.
    3.  Create environment variables.
      EXP_srcNSXmgrURL=https://nsxmgr.fqdn.com
      export EXP_srcNSXmgrURL
      EXP_srcNSXmgrUsername="admin"
      export EXP_srcNSXmgrUsername
      EXP_srcNSXmgrPassword="password-for-admin"
      export EXP_srcNSXmgrPassword
      $env:EXP_srcNSXmgrURL = “https://nsxmgr.fqdn.com”
      $env:EXP_srcNSXmgrUsername = "admin"
      $env:EXP_srcNSXmgrPassword = "password-for-admin"

Step 2 – Run the export

Whether you’re exporting from VMware Cloud on AWS, or on-prem NSX, you run the same command to perform the export.

python3 nsx_import_export.py -o export
python ./nsx_import_export.py -o export

Here is the start and finish of the export command:

Terminal window showing the start of the export command

Figure 5: Terminal window showing the start of the export command

Terminal window showing the end of the export command

Figure 6: Terminal window showing the end of the export command

The program will place a zipped file in the /json directory with a name that ends in _json-export.zip. You can now use this file in Amazon Q Developer transformation capabilities for VMware for VMware. You can learn more about Amazon Q Developer transformation capabilities for VMware in this technical walkthrough.

Cleanup

To clean up your environment, do the following:

  1. To ensure your credentials are cleared from memory, close your terminal window.
  2. Delete the zipped file in the /json directory with a name that ends in _json-export.zip.
  3.  If you do not need to use the tool again, you can delete the entire project folder and contents.

Summary

Import/Export for NSX is an AWS Open Source project that enables you to export on-prem or VMware Cloud on AWS NSX configurations. This blog post provides a comprehensive, step-by-step guide for exporting VMware NSX configurations using the Import/Export for NSX tool, available on GitHub. By streamlining this critical aspect of cloud migration, Amazon continues to demonstrate its commitment to providing innovative, customer-centric solutions that accelerate and simplify the migration of VMware workloads to AWS. Don’t just take our word for it – give the tool a try today! Remember, at Amazon we work backwards from our customers, so we’re eager to hear your feedback as you put this tool through its paces. Your insights will help us continue to iterate and improve, ensuring we’re always delivering the best possible experience to our customers.