You can export most of your current CloudConnexa settings using a custom bash script that runs GET API calls.
Note: CyberShield settings are not yet available through the API. Any CyberShield-related information will not appear in the exported data.
This process requires your CloudConnexa API credentials. To learn how to create API credentials, see Creating API Credentials.
Important: This script must be run on a Linux machine or any system that supports Bash, such as macOS or Windows Subsystem for Linux (WSL).
Make sure the following tools are installed on your system before running the script:
curljq
These tools are preinstalled on most Linux distributions and macOS. If not, install them using your system's package manager (for example, sudo apt install jq curl).
Export your CloudConnexa API credentials as environment variables on your system:
export OPENVPN_CLIENT_ID='CLIENT-ID'
export OPENVPN_CLIENT_SECRET='CLIENT-SECRET'Run the following command to download and execute the import script:
curl -fsSL https://raw.githubusercontent.com/GabrielPalmar/API-Import-CloudConnexa/refs/heads/main/import.sh | bashThe script creates a new folder named cloudconnexa_api_data in the directory where it's executed. Inside, you'll find JSON files containing raw snapshots 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.
The script fetches data from the following CloudConnexa API endpoints:
| Category | Endpoints |
|---|---|
| Access Management | access-groups, access-visibility/enabled |
| Devices | devices, device-postures |
| DNS | dns-records, dns-log/user-dns-resolutions/enabled |
| Networks | networks, networks/routes, networks/ip-services, networks/applications |
| Hosts | hosts, hosts/ip-services, hosts/applications |
| Location | location-contexts |
| Users | users, user-groups |
| Auth Settings | settings/auth/ldap/group-mappings, settings/auth/saml/group-mappings, settings/auth/trusted-devices-allowed, settings/auth/two-factor-auth |
| DNS Settings | settings/dns/custom-servers, settings/dns/default-suffix, settings/dns/proxy-enabled, settings/dns/zones |
| User Settings | settings/user/connect-auth, settings/user/device-allowance, settings/user/device-allowance-force-update, settings/user/device-enforcement, settings/user/profile-distribution, settings/users/connection-timeout |
| WPC Settings | settings/wpc/client-options, settings/wpc/default-region, settings/wpc/domain-routing-subnet, settings/wpc/routes-advanced-configuration-enabled, settings/wpc/snat, settings/wpc/subnet, settings/wpc/topology |
flowchart TD
A[Start] --> B{OPENVPN_CLIENT_ID and<br>OPENVPN_CLIENT_SECRET set?}
B -->|No| C[Exit with Error]
B -->|Yes| D[Generate OAuth Token]
D --> E{Token Valid?}
E -->|No| F[Exit with Error]
E -->|Yes| G[Create cloudconnexa_api_data Directory]
G --> H[Loop Through API Endpoints]
H --> I[Fetch Endpoint Data]
I --> J{Valid JSON Response?}
J -->|No| K[Save Raw Response]
J -->|Yes| L{Empty or Error Response?}
L -->|Yes| M[Skip Endpoint]
L -->|No| N{Multiple Pages?}
N -->|No| O[Extract Items]
N -->|Yes| P[Fetch All Pages]
P --> O
O --> Q{Items Found?}
Q -->|No| M
Q -->|Yes| R[Save to JSON File]
K --> S{More Endpoints?}
M --> S
R --> S
S -->|Yes| H
S -->|No| T[Generate Summary Report]
T --> U[Display Statistics]
U --> V[End]
After execution, the script displays a summary report showing:
- Status of each endpoint (
saved,skipped, orerror) - Number of items retrieved per endpoint
- Total counts for saved, skipped, and error endpoints
Example output:
==========================================
IMPORT SUMMARY REPORT
2024-01-15 10:30:00
==========================================
ENDPOINT STATUS ITEMS
---------------------------------------------- -------------------- ----------
access-groups saved 5
devices saved 12
dns-records skipped 0
...
==========================================
Total endpoints processed: 38
- Saved: 25
- Skipped (empty): 12
- Errors: 1
Data saved in: ./cloudconnexa_api_data/
==========================================