내용으로 건너뛰기

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개 답변
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

답변함 일 년 전
전문가
검토됨 일 년 전
전문가
수정됨 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠