resource_policies
Creates, updates, deletes, gets or lists a resource_policies resource.
Overview
| Name | resource_policies |
| Type | Resource |
| Id | aws.bedrock_agent.resource_policies |
Fields
The following fields are returned by SELECT queries:
- get_resource_policy
| Name | Datatype | Description |
|---|---|---|
policy | string | The JSON-formatted resource policy associated with the knowledge base. (pattern: <code>[\u0009\u000A\u000D\u0020-\u00FF]+</code>) |
resource_arn | string | The 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_id | string | The revision identifier of the resource policy. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_resource_policy | select | resource_arn, region | Retrieves the resource policy associated with a knowledge base. | |
put_resource_policy | replace | resource_arn, region, policy | 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. | |
delete_resource_policy | delete | resource_arn, region | expectedRevisionId | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
resource_arn | string | The Amazon Resource Name (ARN) of the knowledge base to remove the resource policy from. |
expectedRevisionId | string | The expected revision identifier of the resource policy. Use this to prevent conflicts when multiple users update the same policy concurrently. |
SELECT examples
- get_resource_policy
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
- put_resource_policy
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
- delete_resource_policy
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 }}'
;