Skip to main content

resource_policies

Creates, updates, deletes, gets or lists a resource_policies resource.

Overview

Nameresource_policies
TypeResource
Idaws.bedrock_agent.resource_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
policystringThe JSON-formatted resource policy associated with the knowledge base. (pattern: <code>[\u0009\u000A\u000D\u0020-\u00FF]+</code>)
resource_arnstringThe ARN of the knowledge base that the resource policy is associated with. (pattern: <code>arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:knowledge-base/[0-9a-zA-Z]+</code>)
revision_idstringThe revision identifier of the resource policy.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_resource_policyselectresource_arn, regionRetrieves the resource policy associated with a knowledge base.
put_resource_policyreplaceresource_arn, region, policyAssociates a resource policy with a knowledge base. A resource policy allows other AWS accounts to access the knowledge base. For more information, see Cross-account access for knowledge bases.
delete_resource_policydeleteresource_arn, regionexpectedRevisionIdRemoves the resource policy associated with a knowledge base. After deletion, other AWS accounts can no longer access the knowledge base using cross-account permissions.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)
resource_arnstringThe Amazon Resource Name (ARN) of the knowledge base to remove the resource policy from.
expectedRevisionIdstringThe expected revision identifier of the resource policy. Use this to prevent conflicts when multiple users update the same policy concurrently.

SELECT examples

Retrieves the resource policy associated with a knowledge base.

SELECT
policy,
resource_arn,
revision_id
FROM aws.bedrock_agent.resource_policies
WHERE resource_arn = '{{ resource_arn }}' -- required
AND region = '{{ region }}' -- required
;

REPLACE examples

Associates a resource policy with a knowledge base. A resource policy allows other AWS accounts to access the knowledge base. For more information, see Cross-account access for knowledge bases.

REPLACE aws.bedrock_agent.resource_policies
SET
policy = '{{ policy }}',
expectedRevisionId = '{{ expectedRevisionId }}'
WHERE
resource_arn = '{{ resource_arn }}' --required
AND region = '{{ region }}' --required
AND policy = '{{ policy }}' --required
RETURNING
resource_arn,
revision_id;

DELETE examples

Removes the resource policy associated with a knowledge base. After deletion, other AWS accounts can no longer access the knowledge base using cross-account permissions.

DELETE FROM aws.bedrock_agent.resource_policies
WHERE resource_arn = '{{ resource_arn }}' --required
AND region = '{{ region }}' --required
AND expectedRevisionId = '{{ expectedRevisionId }}'
;