Skip to content

put_resource_config async

put_resource_config(
    resource_type: ResourceTypeString,
    schema_version_id: SchemaVersionId,
    resource_id: ResourceId,
    configuration: Configuration,
    *,
    config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
    resource_name: Optional[ResourceName] = None,
    tags: Optional[Tags] = None,
) -> None

Records the configuration state for the resource provided in the request. The configuration state of a resource is represented in Config as Configuration Items. Once this API records the configuration item, you can retrieve the list of configuration items for the custom resource type using existing Config APIs.

The custom resource type must be registered with CloudFormation. This API accepts the configuration item registered with CloudFormation.

When you call this API, Config only stores configuration state of the resource provided in the request. This API does not change or remediate the configuration of the resource.

Write-only schema properites are not recorded as part of the published configuration item.

Parameters:

  • resource_type (ResourceTypeString) –

    The type of the resource. The custom resource type must be registered with CloudFormation.

    You cannot use the organization names “amzn”, “amazon”, “alexa”, “custom” with custom resource types. It is the first part of the ResourceType up to the first ::.

  • schema_version_id (SchemaVersionId) –

    Version of the schema registered for the ResourceType in CloudFormation.

  • resource_id (ResourceId) –

    Unique identifier of the resource.

  • resource_name (Optional[ResourceName], default: None ) –

    Name of the resource.

  • configuration (Configuration) –

    The configuration object of the resource in valid JSON format. It must match the schema registered with CloudFormation.

    The configuration JSON must not exceed 64 KB.

  • tags (Optional[Tags], default: None ) –

    Tags associated with the resource.

    This field is not to be confused with the Amazon Web Services-wide tag feature for Amazon Web Services resources. Tags for PutResourceConfig are tags that you supply for the configuration items of your custom resources.

Raises:

  • InsufficientPermissionsException –

    Indicates one of the following errors:

    • For PutConfigRule, the rule cannot be created because the IAM role assigned to Config lacks permissions to perform the config:Put* action.

    • For PutConfigRule, the Lambda function cannot be invoked. Check the function ARN, and check the function's permissions.

    • For PutOrganizationConfigRule, organization Config rule cannot be created because you do not have permissions to call IAM GetRole action or create a service-linked role.

    • For PutConformancePack and PutOrganizationConformancePack, a conformance pack cannot be created because you do not have the following permissions:

      • You do not have permission to call IAM GetRole action or create a service-linked role.

      • You do not have permission to read Amazon S3 bucket or call SSM:GetDocument.

    • For PutServiceLinkedConfigurationRecorder, a service-linked configuration recorder cannot be created because you do not have the following permissions: IAM CreateServiceLinkedRole.

    • For PutConnector, a connector cannot be created because you do not have the following permissions: IAM CreateServiceLinkedRole.

  • MaxActiveResourcesExceededException –

    You have reached the limit of active custom resource types in your account. There is a limit of 100,000. Delete unused resources using DeleteResourceConfig .

  • NoRunningConfigurationRecorderException –

    There is no configuration recorder running.

  • 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:

    • You have specified more than one configuration recorder.

    • You have provided a service principal for service-linked configuration recorder that is not valid.

    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_resource_config(
    self,
    resource_type: "capo_config_service.types.resource_type_string.ResourceTypeString",
    schema_version_id: "capo_config_service.types.schema_version_id.SchemaVersionId",
    resource_id: "capo_config_service.types.resource_id.ResourceId",
    configuration: "capo_config_service.types.configuration.Configuration",
    *,
    config_overrides: Optional[AsyncConfigServiceClientConfig] = None,
    resource_name: Optional[
        "capo_config_service.types.resource_name.ResourceName"
    ] = None,
    tags: Optional["capo_config_service.types.tags.Tags"] = None,
) -> None:
    """<p>Records the configuration state for the resource provided in the request. The configuration state of a resource is represented in Config as Configuration Items. Once this API records the configuration item, you can retrieve the list of configuration items for the custom resource type using existing Config APIs. </p> <note> <p>The custom resource type must be registered with CloudFormation. This API accepts the configuration item registered with CloudFormation.</p> <p>When you call this API, Config only stores configuration state of the resource provided in the request. This API does not change or remediate the configuration of the resource. </p> <p>Write-only schema properites are not recorded as part of the published configuration item.</p> </note>

    Args:
        resource_type: <p>The type of the resource. The custom resource type must be registered with CloudFormation. </p> <note> <p>You cannot use the organization names “amzn”, “amazon”, “alexa”, “custom” with custom resource types. It is the first part of the ResourceType up to the first ::.</p> </note>
        schema_version_id: <p>Version of the schema registered for the ResourceType in CloudFormation.</p>
        resource_id: <p>Unique identifier of the resource.</p>
        resource_name: <p>Name of the resource.</p>
        configuration: <p>The configuration object of the resource in valid JSON format. It must match the schema registered with CloudFormation.</p> <note> <p>The configuration JSON must not exceed 64 KB.</p> </note>
        tags: <p>Tags associated with the resource.</p> <note> <p>This field is not to be confused with the Amazon Web Services-wide tag feature for Amazon Web Services resources. Tags for <code>PutResourceConfig</code> are tags that you supply for the configuration items of your custom resources.</p> </note>

    Raises:
        capo_config_service.errors.insufficient_permissions_exception.InsufficientPermissionsException: <p>Indicates one of the following errors:</p> <ul> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html">PutConfigRule</a>, the rule cannot be created because the IAM role assigned to Config lacks permissions to perform the config:Put* action.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConfigRule.html">PutConfigRule</a>, the Lambda function cannot be invoked. Check the function ARN, and check the function's permissions.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConfigRule.html">PutOrganizationConfigRule</a>, organization Config rule cannot be created because you do not have permissions to call IAM <code>GetRole</code> action or create a service-linked role.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConformancePack.html">PutConformancePack</a> and <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutOrganizationConformancePack.html">PutOrganizationConformancePack</a>, a conformance pack cannot be created because you do not have the following permissions: </p> <ul> <li> <p>You do not have permission to call IAM <code>GetRole</code> action or create a service-linked role.</p> </li> <li> <p>You do not have permission to read Amazon S3 bucket or call SSM:GetDocument.</p> </li> </ul> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutServiceLinkedConfigurationRecorder.html">PutServiceLinkedConfigurationRecorder</a>, a service-linked configuration recorder cannot be created because you do not have the following permissions: IAM <code>CreateServiceLinkedRole</code>.</p> </li> <li> <p>For <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_PutConnector.html">PutConnector</a>, a connector cannot be created because you do not have the following permissions: IAM <code>CreateServiceLinkedRole</code>.</p> </li> </ul>
        capo_config_service.errors.max_active_resources_exceeded_exception.MaxActiveResourcesExceededException: <p>You have reached the limit of active custom resource types in your account. There is a limit of 100,000. Delete unused resources using <a href="https://docs.aws.amazon.com/config/latest/APIReference/API_DeleteResourceConfig.html">DeleteResourceConfig</a> <code></code>.</p>
        capo_config_service.errors.no_running_configuration_recorder_exception.NoRunningConfigurationRecorderException: <p>There is no configuration recorder running.</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_resource_config_request.PutResourceConfigRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_config_service._operations.starling_dove_service.put_resource_config

        (
            output,
            http_response,
        ) = await capo_config_service._operations.starling_dove_service.put_resource_config.async_put_resource_config(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutResourceConfig")
    )
    input_: capo_config_service.types.put_resource_config_request.PutResourceConfigRequest = {
        "resource_type": resource_type,
        "schema_version_id": schema_version_id,
        "resource_id": resource_id,
        "configuration": configuration,
    }
    if resource_name is not None:
        input_["resource_name"] = resource_name
    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