how to check if my cluster has enabled the ssl/tls in the mongodb atlas api?
- User
how to check if my cluster has enabled the ssl/tls in the mongodb atlas api?
Assistant
how to check if my cluster has enabled the ssl/tls in the mongodb atlas api?
To check if your MongoDB Atlas cluster has SSL/TLS enabled via the MongoDB Atlas API, you can use the Atlas Administration API to retrieve cluster configuration details.
Here’s a step-by-step guide:
You'll need:
You can find your API keys under Organization > Access Manager > API Keys in the Atlas UI.
Send a GET request to the following endpoint:
GET https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}
Replace:
{GROUP-ID} with your Project ID{CLUSTER-NAME} with the name of your clusterUse HTTP Basic Auth with:
In the response JSON, look for the following fields:
{
"clusterType": "REPLICASET",
"sslEnabled": true,
"encryptionAtRestProvider": "AWS",
"replicationSpecs": [
{
"regionConfigs": [
{
"providerName": "AWS",
"regionName": "US_EAST_1",
"electableSpecs": {
"instanceSize": "M10",
"nodeCount": 3
},
"readOnlySpecs": null,
"analyticsSpecs": null
}
]
}
]
}
"sslEnabled": true – This indicates that TLS/SSL is enabled for client connections.curlcurl -u "<API_PUBLIC_KEY>:<API_PRIVATE_KEY>" \
"https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}"
Replace <API_PUBLIC_KEY>, <API_PRIVATE_KEY>, {GROUP-ID}, and {CLUSTER-NAME} accordingly.
You can also check the connection string used to connect to the cluster:
mongodb+srv://<username>:<password>@cluster0.abcd.mongodb.net/test?ssl=true&...
ssl=true or tls=true is in the query parameters, TLS is enabled.| Check | Field | Description |
|---|---|---|
| TLS Enabled | "sslEnabled": true | In the cluster details from the API |
| Connection String | ssl=true or tls=true | In the MongoDB connection string |
| Atlas Default | ✅ TLS always enabled | You cannot disable TLS in MongoDB Atlas |
Let me know if you want to check this using MongoDB Compass, CLI, or Terraform!