Use Case
You need to whitelist a large volume of IP addresses or CIDR ranges (e.g., 50+) for your cluster. Rather than manually inputting each entry into the ScaleGrid Console UI, you require a method to automate the process or perform a single bulk upload.
Solution
While the ScaleGrid user interface (UI) is optimized for manual entry, the ScaleGrid API provides a programmatic way to update your firewall in bulk, reducing manual effort and potential for error.
1. Authenticate
Log in to the API to establish your session credentials and generate your cookiejar.txt.
2. Stage the IP List
The setFirewallRules operation allows you to provide a complete list of IPs in a single request (https://scalegrid.io/api/#tag/Clusters/operation/setFirewallRules).
[IMPORTANT] This operation is not additive. The list you provide in the
cidrListarray will replace any existing firewall rules for that cluster.
Example Request:
curl -k https://console.scalegrid.io/clusters/setClusterLevelIPWhiteList \
-b cookiejar.txt \
-d '{
"clusterID": YOUR_CLUSTER_ID,
"dbType": "MONGODB",
"cidrList": [ "10.1.0.1/32", "10.1.0.2/32", "10.1.0.3/32" ]
}'3. Apply the Changes
Staging the rules does not immediately update the server. You must trigger the configuration task to push these changes live. (https://scalegrid.io/api/#tag/Clusters/operation/configureFirewallRules)
Example Request:
curl -k https://console.scalegrid.io/clusters/configureIPWhiteList \
-b cookiejar.txt \
-d '{ "clusterID": YOUR_CLUSTER_ID, "dbType": "MONGODB"}'
For more information reference our API Documentation: ScaleGrid API - Set Firewall Rules
Comments
0 comments
Article is closed for comments.