Manage a guardrail - Amazon Bedrock

Manage a guardrail

You can modify an existing guardrail to add new configuration policies or edit an existing policy. When you've reached a configuration for your guardrail that you're satisfied with, you can create a static version of the guardrail to use with your models or agents. For more information, see Deploy a guardrail.

View information about your guardrails

Console
To view information about your guardrails
  1. Sign in to the AWS Management Console using an IAM role with Amazon Bedrock permissions, and open the Amazon Bedrock console at https://console.aws.amazon.com/bedrock/.

  2. Choose Guardrails from the left navigation pane. Then, select a guardrail in the Guardrails section.

  3. The Guardrail overview section displays the configurations of the guardrail that apply to all versions.

  4. To view more information about the working draft, select the Working draft in the Working draft section.

  5. To view more information about a specific version of the guardrail, select the version from the Versions section.

To learn more about the working draft and guardrail versions, see Deploy a guardrail.

API

To get information about a guardrail, send a GetGuardrail request and include the ID and version of the guardrail. If you don't specify a version, the response returns details for the DRAFT version.

The following is the request format:

GET /guardrails/guardrailIdentifier?guardrailVersion=guardrailVersion HTTP/1.1

The following is the response format:

HTTP/1.1 200 Content-type: application/json { "blockedInputMessaging": "string", "blockedOutputsMessaging": "string", "contentPolicy": { "filters": [ { "type": "string", "inputStrength": "string", "outputStrength": "string" } ] }, "wordPolicy": { "words": [ { "text": "string" } ], "managedWordLists": [ { "type": "string" } ] }, "sensitiveInformationPolicy": { "piiEntities": [ { "type": "string", "action": "string" } ], "regexes": [ { "name": "string", "description": "string", "regex": "string", "action": "string" } ] }, "createdAt": "string", "description": "string", "failureRecommendations": [ "string" ], "guardrailArn": "string", "guardrailId": "string", "kmsKeyArn": "string", "name": "string", "status": "string", "statusReasons": [ "string" ], "topicPolicyConfig": { "topics": [ { "definition": "string", "examples": [ "string" ], "name": "string", "type": "DENY" } ] }, "updatedAt": "string", "version": "string" }

To list information about all your guardrails, send a ListGuardrails request.

The following is the request format:

GET /guardrails?guardrailIdentifier=guardrailIdentifier&maxResults=maxResults&nextToken=nextToken HTTP/1.1
  • To list the DRAFT version of all your guardrails, don't specify the guardrailIdentifier field.

  • To list all versions of a guardrail, specify the ARN of the guardrail in the guardrailIdentifier field.

You can set the maximum number of results to return in a response in the maxResults field. If there are more results than the number you set, the response returns a nextToken that you can send in another ListGuardrails request to see the next batch of results.

The following is the response format:

HTTP/1.1 200 Content-type: application/json { "guardrails": [ { "arn": "string", "createdAt": "string", "description": "string", "id": "string", "name": "string", "status": "string", "updatedAt": "string", "version": "string" } ], "nextToken": "string" }

Edit a guardrail

Console
To edit a guardrail
  1. Sign in to the AWS Management Console using an IAM role with Amazon Bedrock permissions, and open the Amazon Bedrock console at https://console.aws.amazon.com/bedrock/.

  2. Choose Guardrails from the left navigation pane. Then, select a guardrail in the Guardrails section.

  3. To edit the name, description, tags, or model encryption settings for the guardrail, select Edit in the Guardrail overview section.

  4. To edit specific configurations for the guardrail, select Working draft in the Working draft section.

  5. Select Edit for the sections containing the settings that you want to change.

  6. Make the edits that you need and then select Save and exit to implement the edits.

API

To edit a guardrail, send a UpdateGuardrail request. Include both fields that you want to update as well as fields that you want to keep the same.

The following is the request format:

PUT /guardrails/guardrailIdentifier HTTP/1.1 Content-type: application/json { "blockedInputMessaging": "string", "blockedOutputsMessaging": "string", "contentPolicyConfig": { "filtersConfig": [ { "inputStrength": "NONE | LOW | MEDIUM | HIGH", "outputStrength": "NONE | LOW | MEDIUM | HIGH", "type": "SEXUAL | VIOLENCE | HATE | INSULTS" } ] }, "description": "string", "kmsKeyId": "string", "name": "string", "tags": [ { "key": "string", "value": "string" } ], "topicPolicyConfig": { "topicsConfig": [ { "definition": "string", "examples": [ "string" ], "name": "string", "type": "DENY" } ] } }

The following is the response format:

HTTP/1.1 202 Content-type: application/json { "guardrailArn": "string", "guardrailId": "string", "updatedAt": "string", "version": "string" }

Delete a guardrail

You can delete a guardrail when you no longer need to use it. Be sure to disassociate the guardrail from all the resources or applications that use it before you delete the guardrail in order to avoid potential errors.

Console
To delete a guardrail
  1. Sign in to the AWS Management Console using an IAM role with Amazon Bedrock permissions, and open the Amazon Bedrock console at https://console.aws.amazon.com/bedrock/.

  2. Choose Guardrails from the left navigation pane. Then, select a guardrail in the Guardrails section.

  3. In the Guardrails section, select a guardrail that you want to delete and then choose Delete.

  4. Enter delete in the user input field and choose Delete to delete the guardrail.

API

To delete a guardrail, send a DeleteGuardrail request and only specify the ARN of the guardrail in the guardrailIdentifier field. Don't specify the guardrailVersion

The following is the request format:

DELETE /guardrails/guardrailIdentifier?guardrailVersion=guardrailVersion HTTP/1.1
Warning

If you delete a guardrail, all of its versions will be deleted.

If the deletion is successful, the response returns an HTTP 200 status code.