Creates or updates the customer managed configuration recorder.
You can use this operation to create a new customer managed configuration recorder or to update the roleARN and the recordingGroup for an existing customer managed configuration recorder.
To start the customer managed configuration recorder and begin recording configuration changes for the resource types you specify, use the StartConfigurationRecorder operation.
For more information, see Working with the Configuration Recorder in the Config Developer Guide.
One customer managed configuration recorder per account per Region
You can create only one customer managed configuration recorder for each account for each Amazon Web Services Region.
Default is to record all supported resource types, excluding the global IAM resource types
If you have not specified values for the recordingGroup field, the default for the customer managed configuration recorder is to record all supported resource types, excluding the global IAM resource types: AWS::IAM::Group, AWS::IAM::Policy, AWS::IAM::Role, and AWS::IAM::User.
Tags are added at creation and cannot be updated
PutConfigurationRecorder is an idempotent API. Subsequent requests won’t create a duplicate resource if one was already created. If a following request has different tags values, Config will ignore these differences and treat it as an idempotent request of the previous. In this case, tags will not be updated, even if they are different.
Use TagResource and UntagResource to update tags after creation.
Parameters:
-
configuration_recorder
(ConfigurationRecorder)
–
An object for the configuration recorder. A configuration recorder records configuration changes for the resource types in scope.
-
tags
(Optional[TagsList], default:
None
)
–
The tags for the customer managed configuration recorder. Each tag consists of a key and an optional value, both of which you define.
Raises:
-
InvalidConfigurationRecorderNameException
–
The configuration recorder name is not valid. The prefix "AWSConfigurationRecorderFor" is reserved for service-linked configuration recorders.
-
InvalidRecordingGroupException
–
One of the following errors:
-
You have provided a combination of parameter values that is not valid. For example:
-
Every parameter is either null, false, or empty.
-
You have reached the limit of the number of resource types you can provide for the recording group.
-
You have provided resource types or a recording strategy that are not valid.
-
InvalidRoleException
–
You have provided a null or empty Amazon Resource Name (ARN) for the IAM role assumed by Config and used by the customer managed configuration recorder.
-
MaxNumberOfConfigurationRecordersExceededException
–
You have reached the limit of the number of configuration recorders you can create.
-
UnmodifiableEntityException
–
-
ValidationException
–
The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.
For PutStoredQuery, one of the following errors:
-
There are missing required fields.
-
The input value fails the validation.
-
You are trying to create more than 300 queries.
For DescribeConfigurationRecorders and DescribeConfigurationRecorderStatus, one of the following errors:
For AssociateResourceTypes and DisassociateResourceTypes, one of the following errors:
-
Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.
-
One or more of the specified resource types are already associated or disassociated with the configuration recorder.
-
For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.
For DeleteServiceLinkedConfigurationRecorder, one of the following errors:
-
You have provided both Arn and ServicePrincipal. Only one of Arn or ServicePrincipal can be specified.
-
You have provided a service principal for service-linked configuration recorder that is not valid.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_config_service/_services/async_config_service.py
| async def put_configuration_recorder(
self,
configuration_recorder: "capo_config_service.types.configuration_recorder.ConfigurationRecorder",
*,
config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
tags: Optional["capo_config_service.types.tags_list.TagsList"] = None,
) -> None:
"""<p>Creates or updates the customer managed configuration recorder.</p> <p>You can use this operation to create a new customer managed configuration recorder or to update the <code>roleARN</code> and the <code>recordingGroup</code> for an existing customer managed configuration recorder.</p> <p>To start the customer managed configuration recorder and begin recording configuration changes for the resource types you specify, use the <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_StartConfigurationRecorder.html">StartConfigurationRecorder</a> operation.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html"> <b>Working with the Configuration Recorder</b> </a> in the <i>Config Developer Guide</i>.</p> <note> <p> <b>One customer managed configuration recorder per account per Region</b> </p> <p>You can create only one customer managed configuration recorder for each account for each Amazon Web Services Region.</p> <p> <b>Default is to record all supported resource types, excluding the global IAM resource types</b> </p> <p>If you have not specified values for the <code>recordingGroup</code> field, the default for the customer managed configuration recorder is to record all supported resource types, excluding the global IAM resource types: <code>AWS::IAM::Group</code>, <code>AWS::IAM::Policy</code>, <code>AWS::IAM::Role</code>, and <code>AWS::IAM::User</code>.</p> <p> <b>Tags are added at creation and cannot be updated</b> </p> <p> <code>PutConfigurationRecorder</code> is an idempotent API. Subsequent requests won’t create a duplicate resource if one was already created. If a following request has different tags values, Config will ignore these differences and treat it as an idempotent request of the previous. In this case, tags will not be updated, even if they are different.</p> <p>Use <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_TagResource.html">TagResource</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_UntagResource.html">UntagResource</a> to update tags after creation.</p> </note>
Args:
configuration_recorder: <p>An object for the configuration recorder. A configuration recorder records configuration changes for the resource types in scope.</p>
tags: <p>The tags for the customer managed configuration recorder. Each tag consists of a key and an optional value, both of which you define.</p>
Raises:
capo_config_service.errors.invalid_configuration_recorder_name_exception.InvalidConfigurationRecorderNameException: <p>The configuration recorder name is not valid. The prefix "<code>AWSConfigurationRecorderFor</code>" is reserved for service-linked configuration recorders.</p>
capo_config_service.errors.invalid_recording_group_exception.InvalidRecordingGroupException: <p>One of the following errors:</p> <ul> <li> <p>You have provided a combination of parameter values that is not valid. For example:</p> <ul> <li> <p>Setting the <code>allSupported</code> field of <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html">RecordingGroup</a> to <code>true</code>, but providing a non-empty list for the <code>resourceTypes</code>field of <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html">RecordingGroup</a>.</p> </li> <li> <p>Setting the <code>allSupported</code> field of <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingGroup.html">RecordingGroup</a> to <code>true</code>, but also setting the <code>useOnly</code> field of <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_RecordingStrategy.html">RecordingStrategy</a> to <code>EXCLUSION_BY_RESOURCE_TYPES</code>.</p> </li> </ul> </li> <li> <p>Every parameter is either null, false, or empty.</p> </li> <li> <p>You have reached the limit of the number of resource types you can provide for the recording group.</p> </li> <li> <p>You have provided resource types or a recording strategy that are not valid.</p> </li> </ul>
capo_config_service.errors.invalid_role_exception.InvalidRoleException: <p>You have provided a null or empty Amazon Resource Name (ARN) for the IAM role assumed by Config and used by the customer managed configuration recorder.</p>
capo_config_service.errors.max_number_of_configuration_recorders_exceeded_exception.MaxNumberOfConfigurationRecordersExceededException: <p>You have reached the limit of the number of configuration recorders you can create.</p>
capo_config_service.errors.unmodifiable_entity_exception.UnmodifiableEntityException: <p>The requested operation is not valid.</p> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigurationRecorder.html">PutConfigurationRecorder</a>, you will see this exception because you cannot use this operation to create a service-linked configuration recorder. Use the <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html">PutServiceLinkedConfigurationRecorder</a> operation to create a service-linked configuration recorder.</p> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteConfigurationRecorder.html">DeleteConfigurationRecorder</a>, you will see this exception because you cannot use this operation to delete a service-linked configuration recorder. Use the <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html">DeleteServiceLinkedConfigurationRecorder</a> operation to delete a service-linked configuration recorder.</p> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_StartConfigurationRecorder.html">StartConfigurationRecorder</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_StopConfigurationRecorder.html">StopConfigurationRecorder</a>, you will see this exception because these operations do not affect service-linked configuration recorders. Service-linked configuration recorders are always recording. To stop recording, you must delete the service-linked configuration recorder. Use the <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html">DeleteServiceLinkedConfigurationRecorder</a> operation to delete a service-linked configuration recorder.</p>
capo_config_service.errors.validation_exception.ValidationException: <p>The requested operation is not valid. You will see this exception if there are missing required fields or if the input value fails the validation.</p> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutStoredQuery.html">PutStoredQuery</a>, one of the following errors:</p> <ul> <li> <p>There are missing required fields.</p> </li> <li> <p>The input value fails the validation.</p> </li> <li> <p>You are trying to create more than 300 queries.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorders.html">DescribeConfigurationRecorders</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DescribeConfigurationRecorderStatus.html">DescribeConfigurationRecorderStatus</a>, one of the following errors:</p> <ul> <li> <p>You have specified more than one configuration recorder.</p> </li> <li> <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_AssociateResourceTypes.html">AssociateResourceTypes</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DisassociateResourceTypes.html">DisassociateResourceTypes</a>, one of the following errors:</p> <ul> <li> <p>Your configuraiton recorder has a recording strategy that does not allow the association or disassociation of resource types.</p> </li> <li> <p>One or more of the specified resource types are already associated or disassociated with the configuration recorder.</p> </li> <li> <p>For service-linked configuration recorders, the configuration recorder does not record one or more of the specified resource types.</p> </li> </ul> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteServiceLinkedConfigurationRecorder.html">DeleteServiceLinkedConfigurationRecorder</a>, one of the following errors:</p> <ul> <li> <p>You have provided both <code>Arn</code> and <code>ServicePrincipal</code>. Only one of <code>Arn</code> or <code>ServicePrincipal</code> can be specified.</p> </li> <li> <p>You have provided a service principal for service-linked configuration recorder that is not valid.</p> </li> </ul>
capo_config_service.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_config_service.types.put_configuration_recorder_request.PutConfigurationRecorderRequest]",
) -> AsyncOperationResponse[None]:
import capo_config_service._operations.starling_dove_service.put_configuration_recorder
(
output,
http_response,
) = await capo_config_service._operations.starling_dove_service.put_configuration_recorder.async_put_configuration_recorder(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutConfigurationRecorder")
)
input_: capo_config_service.types.put_configuration_recorder_request.PutConfigurationRecorderRequest = {
"configuration_recorder": configuration_recorder
}
if tags is not None:
input_["tags"] = tags
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|