guardrails
Creates, updates, deletes or gets a guardrail resource or lists guardrails in a region
Overview
| Name | guardrails |
| Type | Resource |
| Description | Definition of AWS::Bedrock::Guardrail Resource Type |
| Id | awscc.bedrock.guardrails |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
blocked_input_messaging | string | Messaging for when violations are detected in text |
blocked_outputs_messaging | string | Messaging for when violations are detected in text |
content_policy_config | object | Content policy config for a guardrail. |
contextual_grounding_policy_config | object | Contextual grounding policy config for a guardrail. |
created_at | string | Time Stamp |
cross_region_config | object | The system-defined guardrail profile that you’re using with your guardrail |
description | string | Description of the guardrail or its version |
failure_recommendations | array | List of failure recommendations |
guardrail_arn | string | Arn representation for the guardrail |
guardrail_id | string | Unique id for the guardrail |
kms_key_arn | string | The KMS key with which the guardrail was encrypted at rest |
name | string | Name of the guardrail |
sensitive_information_policy_config | object | Sensitive information policy config for a guardrail. |
status | string | Status of the guardrail |
status_reasons | array | List of status reasons |
tags | array | List of Tags |
topic_policy_config | object | Topic policy config for a guardrail. |
updated_at | string | Time Stamp |
version | string | Guardrail version |
word_policy_config | object | Word policy config for a guardrail. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
guardrail_arn | string | Arn representation for the guardrail |
region | string | AWS region. |
For more information, see AWS::Bedrock::Guardrail.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | guardrails | INSERT | Name, BlockedInputMessaging, BlockedOutputsMessaging, region |
delete_resource | guardrails | DELETE | Identifier, region |
update_resource | guardrails | UPDATE | Identifier, PatchDocument, region |
list_resources | guardrails_list_only | SELECT | region |
get_resource | guardrails | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual guardrail.
SELECT
region,
blocked_input_messaging,
blocked_outputs_messaging,
content_policy_config,
contextual_grounding_policy_config,
created_at,
cross_region_config,
description,
failure_recommendations,
guardrail_arn,
guardrail_id,
kms_key_arn,
name,
sensitive_information_policy_config,
status,
status_reasons,
tags,
topic_policy_config,
updated_at,
version,
word_policy_config
FROM awscc.bedrock.guardrails
WHERE
region = 'us-east-1' AND
Identifier = '{{ guardrail_arn }}';
Lists all guardrails in a region.
SELECT
region,
guardrail_arn
FROM awscc.bedrock.guardrails_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new guardrail resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.bedrock.guardrails (
BlockedInputMessaging,
BlockedOutputsMessaging,
Name,
region
)
SELECT
'{{ blocked_input_messaging }}',
'{{ blocked_outputs_messaging }}',
'{{ name }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.bedrock.guardrails (
BlockedInputMessaging,
BlockedOutputsMessaging,
ContentPolicyConfig,
ContextualGroundingPolicyConfig,
CrossRegionConfig,
Description,
KmsKeyArn,
Name,
SensitiveInformationPolicyConfig,
Tags,
TopicPolicyConfig,
WordPolicyConfig,
region
)
SELECT
'{{ blocked_input_messaging }}',
'{{ blocked_outputs_messaging }}',
'{{ content_policy_config }}',
'{{ contextual_grounding_policy_config }}',
'{{ cross_region_config }}',
'{{ description }}',
'{{ kms_key_arn }}',
'{{ name }}',
'{{ sensitive_information_policy_config }}',
'{{ tags }}',
'{{ topic_policy_config }}',
'{{ word_policy_config }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: guardrail
props:
- name: blocked_input_messaging
value: '{{ blocked_input_messaging }}'
- name: blocked_outputs_messaging
value: '{{ blocked_outputs_messaging }}'
- name: content_policy_config
value:
filters_config:
- type: '{{ type }}'
input_strength: '{{ input_strength }}'
output_strength: null
input_modalities:
- '{{ input_modalities[0] }}'
output_modalities:
- null
input_action: '{{ input_action }}'
output_action: null
input_enabled: '{{ input_enabled }}'
output_enabled: '{{ output_enabled }}'
content_filters_tier_config:
tier_name: '{{ tier_name }}'
- name: contextual_grounding_policy_config
value:
filters_config:
- type: '{{ type }}'
threshold: null
action: '{{ action }}'
enabled: '{{ enabled }}'
- name: cross_region_config
value:
guardrail_profile_arn: '{{ guardrail_profile_arn }}'
- name: description
value: '{{ description }}'
- name: kms_key_arn
value: '{{ kms_key_arn }}'
- name: name
value: '{{ name }}'
- name: sensitive_information_policy_config
value:
pii_entities_config:
- type: '{{ type }}'
action: '{{ action }}'
input_action: null
output_action: null
input_enabled: '{{ input_enabled }}'
output_enabled: '{{ output_enabled }}'
regexes_config:
- name: '{{ name }}'
description: '{{ description }}'
pattern: '{{ pattern }}'
action: null
input_action: null
output_action: null
input_enabled: '{{ input_enabled }}'
output_enabled: '{{ output_enabled }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
- name: topic_policy_config
value:
topics_config:
- name: '{{ name }}'
definition: '{{ definition }}'
examples:
- '{{ examples[0] }}'
type: '{{ type }}'
input_action: '{{ input_action }}'
output_action: null
input_enabled: '{{ input_enabled }}'
output_enabled: '{{ output_enabled }}'
topics_tier_config:
tier_name: '{{ tier_name }}'
- name: word_policy_config
value:
words_config:
- text: '{{ text }}'
input_action: '{{ input_action }}'
output_action: null
input_enabled: '{{ input_enabled }}'
output_enabled: '{{ output_enabled }}'
managed_word_lists_config:
- type: '{{ type }}'
input_action: null
output_action: null
input_enabled: '{{ input_enabled }}'
output_enabled: '{{ output_enabled }}'
UPDATE example
Use the following StackQL query and manifest file to update a guardrail resource, using stack-deploy.
/*+ update */
UPDATE awscc.bedrock.guardrails
SET PatchDocument = string('{{ {
"BlockedInputMessaging": blocked_input_messaging,
"BlockedOutputsMessaging": blocked_outputs_messaging,
"ContentPolicyConfig": content_policy_config,
"ContextualGroundingPolicyConfig": contextual_grounding_policy_config,
"CrossRegionConfig": cross_region_config,
"Description": description,
"KmsKeyArn": kms_key_arn,
"Name": name,
"SensitiveInformationPolicyConfig": sensitive_information_policy_config,
"Tags": tags,
"TopicPolicyConfig": topic_policy_config,
"WordPolicyConfig": word_policy_config
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ guardrail_arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.bedrock.guardrails
WHERE
Identifier = '{{ guardrail_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the guardrails resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
bedrock:CreateGuardrail,
bedrock:GetGuardrail,
kms:DescribeKey,
kms:CreateGrant,
kms:GenerateDataKey,
kms:Decrypt,
bedrock:TagResource,
bedrock:ListTagsForResource
bedrock:GetGuardrail,
kms:Decrypt,
bedrock:ListTagsForResource
bedrock:UpdateGuardrail,
bedrock:GetGuardrail,
bedrock:ListTagsForResource,
bedrock:TagResource,
bedrock:UntagResource,
kms:DescribeKey,
kms:CreateGrant,
kms:GenerateDataKey,
kms:Decrypt
bedrock:DeleteGuardrail,
bedrock:GetGuardrail,
kms:Decrypt,
kms:RetireGrant
bedrock:ListGuardrails