You can export most of your current CloudConnexa settings using a custom Bash script that performs GET API calls and downloads your configuration data as JSON files.
Note: CyberShield settings aren't available through the API at this time. Any CyberShield-related configuration won't be included in the exported data.
Before You Begin
Before exporting your settings, ensure your system is properly prepared.
1. Confirm you have API credentials
You must have active CloudConnexa API credentials.
If you haven't created them yet, refer to Creating API Credentials.
You'll use:
OPENVPN_CLIENT_IDOPENVPN_CLIENT_SECRET
2. Ensure you're using a Bash-supported environment
The export script is written in Bash and must run in a compatible terminal environment, such as:
- A Linux machine
- macOS
- Windows Subsystem for Linux (WSL).
The script won't run in standard Windows Command Prompt or PowerShell unless you're using WSL.
3. Verify required tools are installed
The export script relies on two command-line tools:
curl: Used to download the export script and make API requests to CloudConnexa.jq: Used to process and format JSON responses returned by the API.
Many Linux distributions and macOS systems already include curl. However, jq may not always be installed by default.
To verify they're installed:
Open a terminal.
-
Run the following:
curl --version
-
Then run:
jq --version
If version information appears for both, you are ready to proceed. If a tool is missing, a message such as
command not foundwill display.
4. Install missing tools (if necessary)
If either command returns a 'not found' message, install the missing tool using your system's package manager.
For example, on Ubuntu or Debian:
sudo apt install jq curl
Step 1: Set up API credentials
You must export your CloudConnexa API credentials as environment variables on your system before running the script.
To set your credentials:
Open a terminal.
-
Run the following commands, replacing the placeholder values with your actual credentials:
export OPENVPN_CLIENT_ID='CLIENT-ID' export OPENVPN_CLIENT_SECRET='CLIENT-SECRET'
Press Enter after each command.
Step 2: Run the script
Run the following command to download and execute the import script:
In the same terminal session, run:
Press Enter.
-
Wait for the script to complete.
-
The script will automatically authenticate using your exported credentials.
curl -fsSL https://raw.githubusercontent.com/OpenVPN/cloudconnexa-api-scripts/refs/heads/main/export-config/export.sh | bash
It will retrieve configuration data using API GET calls.
-
The script must be run in the same session where the environment variables were defined.
Step 3: Review the exported files
Once the script completes, it creates a folder named cloudconnexa_api_data
The folder is created in the directory where you executed the script.
To review your exported data:
- Navigate to the exported directory where you ran the script.
- Locate the
cloudconnexa_api_datafolder. - Open the folder.
- Review the generated
.jsonfiles.
Each file contains a raw API snapshot of a specific portion of your CloudConnexa configuration.
These files are useful for:
Backups and auditing.
Preparing data for migration or restore tools.
Note: The JSON files are raw API responses. They may need formatting or adjustments before being used in POST or PUT API requests.
Comments
0 comments
Please sign in to leave a comment.