Amazon Bedrock

2026/04/03 - Amazon Bedrock - 3 new 2 updated api methods

Changes  Amazon Bedrock Guardrails enforcement configuration APIs now support selective guarding controls for system prompts as well as user and assistant messages, along with SDK support for Amazon Bedrock resource policy APIs.

PutResourcePolicy (new) Link ¶

Adds a resource policy for a Bedrock resource.

See also: AWS API Documentation

Request Syntax

client.put_resource_policy(
    resourceArn='string',
    resourcePolicy='string'
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the Bedrock resource to which this resource policy applies.

type resourcePolicy:

string

param resourcePolicy:

[REQUIRED]

The JSON string representing the Bedrock resource policy.

rtype:

dict

returns:

Response Syntax

{
    'resourceArn': 'string'
}

Response Structure

  • (dict) --

    • resourceArn (string) --

      The ARN of the Bedrock resource to which this resource policy applies.

GetResourcePolicy (new) Link ¶

Gets the resource policy document for a Bedrock resource

See also: AWS API Documentation

Request Syntax

client.get_resource_policy(
    resourceArn='string'
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the Bedrock resource to which this resource policy applies.

rtype:

dict

returns:

Response Syntax

{
    'resourcePolicy': 'string'
}

Response Structure

  • (dict) --

    • resourcePolicy (string) --

      The JSON string representing the Bedrock resource policy.

DeleteResourcePolicy (new) Link ¶

Deletes a previously created Bedrock resource policy.

See also: AWS API Documentation

Request Syntax

client.delete_resource_policy(
    resourceArn='string'
)
type resourceArn:

string

param resourceArn:

[REQUIRED]

The ARN of the Bedrock resource to which this resource policy applies.

rtype:

dict

returns:

Response Syntax

{}

Response Structure

  • (dict) --

ListEnforcedGuardrailsConfiguration (updated) Link ¶
Changes (response)
{'guardrailsConfig': {'selectiveContentGuarding': {'messages': 'SELECTIVE | '
                                                               'COMPREHENSIVE',
                                                   'system': 'SELECTIVE | '
                                                             'COMPREHENSIVE'}}}

Lists the account-level enforced guardrail configurations.

See also: AWS API Documentation

Request Syntax

client.list_enforced_guardrails_configuration(
    nextToken='string'
)
type nextToken:

string

param nextToken:

Opaque continuation token of previous paginated response.

rtype:

dict

returns:

Response Syntax

{
    'guardrailsConfig': [
        {
            'configId': 'string',
            'guardrailArn': 'string',
            'guardrailId': 'string',
            'inputTags': 'HONOR'|'IGNORE',
            'selectiveContentGuarding': {
                'system': 'SELECTIVE'|'COMPREHENSIVE',
                'messages': 'SELECTIVE'|'COMPREHENSIVE'
            },
            'guardrailVersion': 'string',
            'createdAt': datetime(2015, 1, 1),
            'createdBy': 'string',
            'updatedAt': datetime(2015, 1, 1),
            'updatedBy': 'string',
            'owner': 'ACCOUNT',
            'modelEnforcement': {
                'includedModels': [
                    'string',
                ],
                'excludedModels': [
                    'string',
                ]
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • guardrailsConfig (list) --

      Array of AccountEnforcedGuardrailOutputConfiguration objects.

      • (dict) --

        Account enforced guardrail output configuration.

        • configId (string) --

          Unique ID for the account enforced configuration.

        • guardrailArn (string) --

          ARN representation for the guardrail.

        • guardrailId (string) --

          Unique ID for the guardrail.

        • inputTags (string) --

          Whether to honor or ignore input tags at runtime.

        • selectiveContentGuarding (dict) --

          Selective content guarding controls for enforced guardrails.

          • system (string) --

            Selective guarding mode for system prompts."

          • messages (string) --

            Selective guarding mode for user messages.

        • guardrailVersion (string) --

          Numerical guardrail version.

        • createdAt (datetime) --

          Timestamp.

        • createdBy (string) --

          The ARN of the role used to update the configuration.

        • updatedAt (datetime) --

          Timestamp.

        • updatedBy (string) --

          The ARN of the role used to update the configuration.

        • owner (string) --

          Configuration owner type.

        • modelEnforcement (dict) --

          Model-specific information for the enforced guardrail configuration.

          • includedModels (list) --

            Models to enforce the guardrail on.

            • (string) --

          • excludedModels (list) --

            Models to exclude from enforcement of the guardrail.

            • (string) --

    • nextToken (string) --

      Opaque continuation token of previous paginated response.

PutEnforcedGuardrailConfiguration (updated) Link ¶
Changes (request)
{'guardrailInferenceConfig': {'selectiveContentGuarding': {'messages': 'SELECTIVE '
                                                                       '| '
                                                                       'COMPREHENSIVE',
                                                           'system': 'SELECTIVE '
                                                                     '| '
                                                                     'COMPREHENSIVE'}}}

Sets the account-level enforced guardrail configuration.

See also: AWS API Documentation

Request Syntax

client.put_enforced_guardrail_configuration(
    configId='string',
    guardrailInferenceConfig={
        'guardrailIdentifier': 'string',
        'guardrailVersion': 'string',
        'selectiveContentGuarding': {
            'system': 'SELECTIVE'|'COMPREHENSIVE',
            'messages': 'SELECTIVE'|'COMPREHENSIVE'
        },
        'modelEnforcement': {
            'includedModels': [
                'string',
            ],
            'excludedModels': [
                'string',
            ]
        }
    }
)
type configId:

string

param configId:

Unique ID for the account enforced configuration.

type guardrailInferenceConfig:

dict

param guardrailInferenceConfig:

[REQUIRED]

Account-level enforced guardrail input configuration.

  • guardrailIdentifier (string) -- [REQUIRED]

    Identifier for the guardrail, could be the ID or the ARN.

  • guardrailVersion (string) -- [REQUIRED]

    Numerical guardrail version.

  • selectiveContentGuarding (dict) --

    Selective content guarding controls for enforced guardrails.

    • system (string) --

      Selective guarding mode for system prompts."

    • messages (string) --

      Selective guarding mode for user messages.

  • modelEnforcement (dict) --

    Model-specific information for the enforced guardrail configuration. If not present, the configuration is enforced on all models

    • includedModels (list) -- [REQUIRED]

      Models to enforce the guardrail on.

      • (string) --

    • excludedModels (list) -- [REQUIRED]

      Models to exclude from enforcement of the guardrail.

      • (string) --

rtype:

dict

returns:

Response Syntax

{
    'configId': 'string',
    'updatedAt': datetime(2015, 1, 1),
    'updatedBy': 'string'
}

Response Structure

  • (dict) --

    • configId (string) --

      Unique ID for the account enforced configuration.

    • updatedAt (datetime) --

      Timestamp.

    • updatedBy (string) --

      The ARN of the role used to update the configuration.