Hi
I am using the following code to downscale my mongodb cluster from M40 to R40 but unable to do so. I want to downscale the cluster at night time when there is lesser traffic to save the cost.
exports = async function () {
// Supply projectID and clusterNames...
const projectID = <projectId>;
const clusterName = <clusterName>;
// Get stored credentials...
const username = <AtlasPublicKey>;
const password =<AtlasPrivateKey>;
// Set the desired instance size...
const body = {
"providerSettings": {
"providerName": <Provider name>,
"instanceSizeName": "R40"
}
};
result = await context.functions.execute('modifyCluster', username, password, projectID, clusterName, body);
console.log(JSON.stringify(result));
if (result.error) {
return result;
}
return clusterName + " scaled down";
};
On executing the above trigger on M40 cluster gives me following error:
{
"detail": "The min instance size (M40) must be in the same instance family as the proposed instance size (R40).",
"error": {
"$numberInt": "400"
},
"errorCode": "COMPUTE_AUTO_SCALING_MIN_INSTANCE_SIZE_FAMILY_INVALID",
"parameters": [
"M40",
"R40"
],
"reason": "Bad Request"
}
If anyone can help me to achieve this downscaling activity