A project's automation configuration determines the goal state of its MongoDB processes and agents. The MongoDB Agent builds the deployment according to the goals specified.
To update the configuration:
Retrieve the current configuration.
You can use either the /groups/{PROJECT-ID}/automationConfig endpoint to get the full configuration, or the /groups/{PROJECT-ID}/automationConfig/noSecrets endpoint to get the configuration with sensitive information redacted, such as passwords or key values.
Make changes to a copy of the current configuration, changing only those items you want modified.
Replace the entire configuration using
PUT, with the updated configuration in the request body. You must usePUT. Do not usePATCH.When you submit updates, Cloud Manager makes internal modifications to the data and then saves your new configuration version.
Note
Some parameters cannot be updated through the automationConfig
endpoint. To learn more, see:
To make updates to the MongoDB Agent other than hostname, you
must do so through a different endpoint.
Important
An automation configuration might contain sensitive information, including passwords or key values. To update a project's automation configuration without updating any fields that contain sensitive information, use the /groups/{PROJECT-ID}/automationConfig/noSecrets endpoint.
Prerequisites
You must have access to the API. To learn more, see Configure API Access.
Variables for Automation Config API Resources
The API resources use one or more of these variables. Replace these variables with your desired values before calling these API resources.
Name | Type | Description |
|---|---|---|
| string | Your public API Key for your API credentials. |
| string | Your private API Key for your API credentials. |
| string | URL of your Cloud Manager instance. |
| string | Unique identifier of your project from your project settings. |
| string | Unique identifier of your cluster. |
Procedure
Retrieve and validate the automation configuration from Cloud Manager.
Use the automationConfig resource to retrieve the configuration. Issue the following command, replacing the placeholders with the Variables for Automation Config API Resources.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --request GET "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/automationConfig?pretty=true" \ --output currentAutomationConfig.json Validate the downloaded Automation Configuration file.
Compare the
versionfield of thecurrentAutomationConfig.jsonwith that of the Automation Configuration backup file,mms-cluster-config-backup.json. Theversionvalue is the last element in both JSON documents. You can find this file on any host running the MongoDB Agent at:Linux and macOS:
/var/lib/mongodb-mms-automation/mms-cluster-config-backup.jsonWindows:
%SystemDrive%\MMSAutomation\versions\mms-cluster-config-backup.json
If the
versionvalues match, you are working with the current version of the Automation Configuration file.
Edit the downloaded automation configuration file.
Open currentAutomationConfig.json in your preferred text editor.
To learn more about the automation configuration options, see Automation Configuration.
If you're updating the MongoDB Agent, see Update Agent Versions before continuing with this procedure.
Send the updated automation configuration.
Use the automationConfig resource to send the updated automation configuration.
Issue the following command with path to the updated configuration document and replace the placeholders with the Variables for Automation Config API Resources.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Content-Type: application/json" --request PUT "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/automationConfig?pretty=true" \ --data @currentAutomationConfig.json
Upon successful update of the configuration, the API returns the HTTP
200 OK status code to indicate the request has succeeded.
Confirm successful update of the automation configuration.
Retrieve the automation configuration from Cloud Manager and confirm it contains the changes. To retrieve the configuration, issue the following command, replacing the placeholders with the Variables for Automation Config API Resources.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --request GET "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/automationConfig?pretty=true"
Check the deployment status to ensure goal state is reached.
Use the automationStatus resource to retrieve the deployment status. Issue the following command, replacing the placeholders with the Variables for Automation Config API Resources.
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --request GET "https://cloud.mongodb.com/api/public/v1.0/groups/{PROJECT-ID}/automationStatus?pretty=true"
Confirm that the values of all the lastGoalVersionAchieved fields
in the processes array match the goalVersion field. To learn
about deployment status, see Get Automation Status of Latest Plan.