AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Bedrock::Guardrail

CfnGuardrail

Creates a guardrail to detect and filter harmful content in your generative AI application. Amazon Bedrock Guardrails provides the following safeguards (also known as policies) to detect and filter harmful content: - *Content filters* - Detect and filter harmful text or image content in input prompts or model responses. Filtering is done based on detection of certain predefined harmful content categories: Hate, Insults, Sexual, Violence, Misconduct and Prompt Attack. You also can adjust the filter strength for each of these categories. - *Denied topics* - Define a set of topics that are undesirable in the context of your application. The filter will help block them if detected in user queries or model responses. - *Word filters* - Configure filters to help block undesirable words, phrases, and profanity (exact match). Such words can include offensive terms, competitor names, etc. - *Sensitive information filters* - Configure filters to help block or mask sensitive information, such as personally identifiable information (PII), or custom regex in user inputs and model responses. Blocking or masking is done based on probabilistic detection of sensitive information in standard formats in entities such as SSN number, Date of Birth, address, etc. This also allows configuring regular expression based detection of patterns for identifiers. - *Contextual grounding check* - Help detect and filter hallucinations in model responses based on grounding in a source and relevance to the user query. For more information, see [How Amazon Bedrock Guardrails works](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-how.html) .

Import

import { CfnGuardrail } from 'aws-cdk-lib/aws-bedrock';

Or use the module namespace:

import * as bedrock from 'aws-cdk-lib/aws-bedrock';
// bedrock.CfnGuardrail

Properties

Configuration passed to the constructor as CfnGuardrailProps.

blockedInputMessagingRequired
string

The message to return when the guardrail blocks a prompt.

blockedOutputsMessagingRequired
string

The message to return when the guardrail blocks a model response.

nameRequired
string

The name of the guardrail.

automatedReasoningPolicyConfigOptional
IResolvable | AutomatedReasoningPolicyConfigProperty

Configuration settings for integrating Automated Reasoning policies with Amazon Bedrock Guardrails.

contentPolicyConfigOptional
IResolvable | ContentPolicyConfigProperty

The content filter policies to configure for the guardrail.

contextualGroundingPolicyConfigOptional
IResolvable | ContextualGroundingPolicyConfigProperty

Contextual grounding policy config for a guardrail.

crossRegionConfigOptional
IResolvable | GuardrailCrossRegionConfigProperty

The system-defined guardrail profile that you're using with your guardrail. Guardrail profiles define the destination AWS Regions where guardrail inference requests can be automatically routed. Using guardrail profiles helps maintain guardrail performance and reliability when demand increases. For more information, see the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-cross-region.html) .

descriptionOptional
string

A description of the guardrail.

kmsKeyArnOptional
string

The ARN of the AWS key that you use to encrypt the guardrail.

sensitiveInformationPolicyConfigOptional
IResolvable | SensitiveInformationPolicyConfigProperty

The sensitive information policy to configure for the guardrail.

tagsOptional
CfnTag[]

The tags that you want to attach to the guardrail.

topicPolicyConfigOptional
IResolvable | TopicPolicyConfigProperty

The topic policies to configure for the guardrail.

wordPolicyConfigOptional
IResolvable | WordPolicyConfigProperty

The word policy you configure for the guardrail.

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter