Skip to content

How to Stop recording AWS::Config::ResourceCompliance

0

Hi there, I try to follow this cost saving best practice when deleting an AWS config rule:

https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html

It says

  1. Stop recording AWS::Config::ResourceCompliance
  2. Delete rule(s)
  3. Turn on recording for AWS::Config::ResourceCompliance

My question is how to do the first step, stopping AWS::Config::ResourceCompliance?

Amazon Q suggestion (cli command) is not wokring in cloudshell:

aws configservice put-configuration-recorder --configuration-recorder name=default --recording-group allSupported=false,includeGlobalResourceTypes=false,resourceTypes=[<list of resource types excluding AWS::Config::ResourceCompliance>]

That i run as

aws configservice put-configuration-recorder --configuration-recorder name=default --recording-group allSupported=false,includeGlobalResourceTypes=false,resourceTypes=[AWS::Config::ResourceCompliance]

The error of runnig the above in the cloudshell says "An error occurred (InvalidRoleException) when calling the PutConfigurationRecorder operation: The role arn passed is not valid."

Any advice is appreciated.

1 Answer
1

To stop recording for AWS::Config::ResourceCompliance, you need to modify your AWS Config configuration recorder settings. The approach you're trying is on the right track, but there are a few adjustments needed:

  1. First, ensure that you specify the correct IAM role for the recorder when configuring its settings. The error you received is likely caused by the role ARN not being specified in the request, or permissions specified for the role being insufficient.

  2. Instead of including AWS::Config::ResourceCompliance in the resourceTypes list, you should exclude it. The goal is to stop recording this specific resource type.

  3. You'll need to use the EXCLUSION_BY_RESOURCE_TYPES recording strategy.

Here's a corrected version of the command:

aws configservice put-configuration-recorder --configuration-recorder name=default,roleARN=<your-config-role-arn> --recording-group recordingStrategy={useOnly=EXCLUSION_BY_RESOURCE_TYPES},allSupported=true,includeGlobalResourceTypes=true,exclusionByResourceTypes={resourceTypes=[AWS::Config::ResourceCompliance]}

Replace <your-config-role-arn> with the actual ARN of the IAM role associated with your AWS Config.

This command will:

  • Set the recording strategy to exclude specific resource types
  • Continue recording all supported resource types except AWS::Config::ResourceCompliance
  • Include global resource types
  • Explicitly exclude AWS::Config::ResourceCompliance from recording

After executing this command successfully, AWS Config will stop recording for the AWS::Config::ResourceCompliance resource type. You can then proceed with deleting your rules. Remember to turn recording back on for AWS::Config::ResourceCompliance after you've finished deleting the rules to complete the best practice procedure.
Sources
RecordingStrategy - AWS Config
DeleteConfigRule - AWS Config
Evaluating Resources with AWS Config Rules - AWS Config

answered a year ago
EXPERT
reviewed a year ago
EXPERT
revised a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.