Skip to content

Why do I receive a MaxNumberOfConfigurationRecordersExceededException error when I create an AWS Config configuration recorder?

3 minute read
0

When I create an AWS Config configuration recorder, I get a MaxNumberOfConfigurationRecordersExceededException error.

Short description

AWS Config uses a configuration recorder to record changes in your resource configuration. AWS Config allows only one configuration recorder per AWS Region in an account. The MaxNumberOfConfigurationRecordersExceededException error indicates that you can't create a new configuration recorder because one is already present on your account for the Region. The error occurs regardless of whether you use the AWS Config console, AWS Command Line Interface (AWS CLI), or AWS CloudFormation to create the recorder.

Resolution

Note: If you receive errors when you run AWS CLI commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

To resolve the MaxNumberOfConfigurationRecordersExceededException error and create a new configuration recorder, you must identify and delete the existing configuration recorder.

Note: You can't delete a configuration recorder from the console. You must programmatically perform deletions.

First, verify that the correct AWS Identity and Access Management (IAM) permissions are in place to run the required commands. Then, you can use the AWS CLI or CloudFormation to identify and delete the existing configuration recorder.

IAM permissions

To describe and delete a configuration recorder, add the following IAM permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "config:DescribeConfigurationRecorders",
                "config:DeleteConfigurationRecorder"
            ],
            "Resource": "*"
        }
    ]
}

To start and stop a configuration recorder, add the following IAM permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "config:PutConfigurationRecorder",
                "iam:PassRole",
                "config:DescribeConfigurationRecorders",
                "config:StopConfigurationRecorder",
                "config:StartConfigurationRecorder",
                "config:DeleteConfigurationRecorder"
            ],
            "Resource": "*"
        }
    ]
}

For AWS CLI, identify and delete a configuration recorder

Complete the following tasks.

Identify the existing configuration recorder name

To identify the existing configuration recorder in a specific Region, run the describe-configuration-recorders command:

$aws configservice describe-configuration-recorders --region RegionID

Note: Replace RegionID with your Region.

Review the output. The existing configuration recorder name is listed next to name in the output.

Delete the existing configuration recorder

To delete the existing configuration recorder, run the delete-configuration-recorder command:

$aws configservice delete-configuration-recorder --configuration-recorder-name RecorderName --region RegionID

Note: Replace RecorderName with the name of your configuration recorder and RegionID with your Region ID. When you successfully deleted the recorder, the delete-configuration-recorder command doesn't return an output.

Use API calls to start and stop the recorder

To start a configuration recorder, run the following command:

$aws configservice start-configuration-recorder --configuration-recorder-name RecorderName

Note: Replace RecorderName with the name of your configuration recorder.

To stop a configuration recorder, run the following command:

$aws configservice stop-configuration-recorder --configuration-recorder-name RecorderName

Note: Replace RecorderName with the name of your configuration recorder.

For CloudFormation, identify and delete a configuration recorder

If you use a CloudFormation StackSet template to turn on AWS Config, then complete the following tasks to identify and delete a configuration recorder.

To write code logic to identify and delete a configuration recorder, use an AWS Lambda-backed custom resource to perform the following:

After you delete the configuration recorder, you can use the cfn-response module for custom resources to create a new configuration recorder. Then, you can run the StartConfigurationRecorder API to start the recorder.

Related information

CloudFormation custom resource creation with Python, AWS Lambda, and crhelper

AWS OFFICIALUpdated 2 years ago