Uploading a rules configuration file to Amazon Managed Service for Prometheus
Now you must upload this rules configuration file to Amazon Managed Service for Prometheus. You can use either the console or the AWS CLI to upload it.
To use the Amazon Managed Service for Prometheus console to upload your rules configuration and create the namespace
Open the Amazon Managed Service for Prometheus console at https://console.aws.amazon.com/prometheus/
. In the upper left corner of the page, choose the menu icon, and then choose All workspaces.
Choose the workspace ID of the workspace, and then choose the Rules management tab.
Choose Add namespace.
Choose Choose file, and select the rules definition file.
(Optional) To add tags to the namespace, choose Add new tag.
Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value.
To add another tag, choose Add new tag.
Choose Continue. Amazon Managed Service for Prometheus creates a new namespace with the same name as the rules file that you selected.
To use the AWS CLI to upload an alert manager configuration to a workspace in a new namespace
Base64 encode the contents of your alert manager file. On Linux, you can use the following command:
base64
input-file
output-file
On macOS, you can use the following command:
openssl base64
input-file
output-file
Enter one of the following commands to create the namespace and upload the file.
On AWS CLI version 2, enter:
aws amp create-rule-groups-namespace --data file://
path_to_base_64_output_file
--namenamespace-name
--workspace-idmy-workspace-id
--regionregion
On AWS CLI version 1, enter:
aws amp create-rule-groups-namespace --data fileb://
path_to_base_64_output_file
--namenamespace-name
--workspace-idmy-workspace-id
--regionregion
-
It takes a few seconds for your alert manager configuration to become active. To check the status, enter the following command:
aws amp describe-rule-groups-namespace --workspace-id
workspace_id
--namenamespace-name
--regionregion
If the
status
isACTIVE
, your rules file has taken effect.