Skip to content

Commit 98441cb

Browse files
author
ievgeniia ieromenko
committed
Merge remote-tracking branch 'origin/main' into cloudtrail-305
2 parents ddf1870 + 7fa1320 commit 98441cb

File tree

35 files changed

+1555
-36
lines changed

35 files changed

+1555
-36
lines changed

aws_sra_examples/solutions/genai/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This directory contains security solutions for implementing generative AI capabi
1414
## Solutions
1515

1616
- [SRA Bedrock Organizations Solution](./bedrock_org/)
17-
This solution provides an automated framework for deploying Bedrock organizational security controls.
17+
This solution provides an automated framework for deploying Bedrock organizational safeguards.
1818

1919
- [SRA Bedrock Guardrails Solution](./bedrock_guardrails/)
2020
This solution provides an automated framework for deploying Bedrock guardrails across multiple AWS accounts and regions in an organization.

aws_sra_examples/solutions/genai/bedrock_guardrails/lambda/src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Version: 1.0
44
5-
Main app module for SRA GenAI Bedrock org security controls solution in the repo,
5+
Main app module for SRA GenAI Bedrock org safeguards solution in the repo,
66
https://github.com/aws-samples/aws-security-reference-architecture-examples
77
88
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

aws_sra_examples/solutions/genai/bedrock_org/README.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
- [Security Controls](#security-controls)
88
- [JSON Parameters](#json-parameters)
99
- [References](#references)
10+
- [Related Security Control Solutions](#related-security-control-solutions)
1011

1112
---
1213

1314
## Introduction
1415

15-
This solution provides an automated framework for deploying Bedrock organizational security controls using AWS CloudFormation. It leverages a Lambda function to configure and deploy AWS Config rules, CloudWatch metrics, and other resources necessary to monitor and enforce governance policies across multiple AWS accounts and regions in an organization.
16+
This solution provides an automated framework for deploying Bedrock organizational safeguards using AWS CloudFormation. It leverages a Lambda function to configure and deploy AWS Config rules, CloudWatch metrics, and other resources necessary to monitor and enforce governance policies across multiple AWS accounts and regions in an organization.
1617

1718
The architecture follows best practices for security and scalability and is designed for easy extensibility.
1819

@@ -102,6 +103,11 @@ aws cloudformation create-stack \
102103
ParameterKey=pBedrockPromptInjectionFilterParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\"], \"filter_params\": {\"log_group_name\": \"model-invocation-log-group\", \"input_path\": \"input.inputBodyJson.messages[0].content\"}}"' \
103104
ParameterKey=pBedrockSensitiveInfoFilterParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\"], \"filter_params\": {\"log_group_name\": \"model-invocation-log-group\", \"input_path\": \"input.inputBodyJson.messages[0].content\"}}"' \
104105
ParameterKey=pBedrockCentralObservabilityParams,ParameterValue='"{\"deploy\": \"true\", \"bedrock_accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\"]}"' \
106+
ParameterKey=pBedrockKBLoggingRuleParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\",\"us-west-2\"], \"input_params\": {}}"' \
107+
ParameterKey=pBedrockKBIngestionEncryptionRuleParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\",\"us-west-2\"], \"input_params\": {}}"' \
108+
ParameterKey=pBedrockKBS3BucketRuleParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\",\"us-west-2\"], \"input_params\": {\"check_retention\": \"true\", \"check_encryption\": \"true\", \"check_access_logging\": \"true\", \"check_object_locking\": \"true\", \"check_versioning\": \"true\"}}"' \
109+
ParameterKey=pBedrockKBVectorStoreSecretRuleParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\",\"us-west-2\"], \"input_params\": {}}"' \
110+
ParameterKey=pBedrockKBOpenSearchEncryptionRuleParams,ParameterValue='"{\"deploy\": \"true\", \"accounts\": [\"222222222222\",\"333333333333\"], \"regions\": [\"us-east-1\",\"us-west-2\"], \"input_params\": {}}"' \
105111
--capabilities CAPABILITY_NAMED_IAM
106112
```
107113

@@ -139,6 +145,11 @@ Please read the following notes before deploying the stack to ensure successful
139145
| CloudWatch Endpoint Validation | Ensures proper CloudWatch VPC endpoint setup | [pBedrockCWEndpointsRuleParams](#pbedrockcwendpointsruleparams) |
140146
| S3 Endpoint Validation | Ensures proper S3 VPC endpoint setup | [pBedrockS3EndpointsRuleParams](#pbedrocks3endpointsruleparams) |
141147
| Guardrail Encryption | Validates KMS encryption for Bedrock guardrails | [pBedrockGuardrailEncryptionRuleParams](#pbedrockguardrailencryptionruleparams) |
148+
| Knowledge Base Logging | Validates logging configuration for Bedrock Knowledge Base | [pBedrockKBLoggingRuleParams](#pbedrockkbloggingruleparams) |
149+
| Knowledge Base Ingestion Encryption | Validates encryption for Knowledge Base data ingestion | [pBedrockKBIngestionEncryptionRuleParams](#pbedrockkbingestionencryptionruleparams) |
150+
| Knowledge Base S3 Bucket | Validates S3 bucket configurations for Knowledge Base | [pBedrockKBS3BucketRuleParams](#pbedrockkbs3bucketruleparams) |
151+
| Knowledge Base Vector Store Secret | Validates vector store secret configuration | [pBedrockKBVectorStoreSecretRuleParams](#pbedrockkbvectorstoresecretruleparams) |
152+
| Knowledge Base OpenSearch Encryption | Validates OpenSearch encryption configuration | [pBedrockKBOpenSearchEncryptionRuleParams](#pbedrockkbopensearchencryptionruleparams) |
142153

143154
> **Important Note**: The Config rule Lambda execution role needs to have access to any KMS keys used to encrypt Bedrock guardrails. Make sure to grant the appropriate KMS key permissions to the Lambda role to ensure proper evaluation of encrypted guardrail configurations.
144155
@@ -155,6 +166,15 @@ Please read the following notes before deploying the stack to ensure successful
155166
|-----------------|-------------|----------------|
156167
| Central Observability | Configures cross-account/region metric aggregation | [pBedrockCentralObservabilityParams](#pbedrockcentralobservabilityparams) |
157168

169+
### Bedrock Knowledge Base
170+
| Security Control | Description | JSON Parameter |
171+
|-----------------|-------------|----------------|
172+
| KB Logging | Validates logging configuration for Bedrock Knowledge Base | [pBedrockKBLoggingRuleParams](#pbedrockkbloggingruleparams) |
173+
| KB Ingestion Encryption | Validates encryption configuration for Bedrock Knowledge Base | [pBedrockKBIngestionEncryptionRuleParams](#pbedrockkbingestionencryptionruleparams) |
174+
| KB S3 Bucket | Validates S3 bucket configuration for Bedrock Knowledge Base | [pBedrockKBS3BucketRuleParams](#pbedrockkbs3bucketruleparams) |
175+
| KB Vector Store Secret | Validates secret configuration for Bedrock Knowledge Base | [pBedrockKBVectorStoreSecretRuleParams](#pbedrockkbvectorstoresecretruleparams) |
176+
| KB OpenSearch Encryption | Validates encryption configuration for Bedrock Knowledge Base | [pBedrockKBOpenSearchEncryptionRuleParams](#pbedrockkbopensearchencryptionruleparams) |
177+
158178
---
159179
## JSON Parameters
160180

@@ -367,6 +387,72 @@ This section explains the parameters in the CloudFormation template that require
367387
}
368388
```
369389

390+
### `pBedrockKBLoggingRuleParams`
391+
- **Purpose**: Validates logging configuration for Bedrock Knowledge Base.
392+
- **Structure**:
393+
```json
394+
{
395+
"deploy": "true|false",
396+
"accounts": ["account_id1", "account_id2"],
397+
"regions": ["region1", "region2"],
398+
"input_params": {}
399+
}
400+
```
401+
402+
### `pBedrockKBIngestionEncryptionRuleParams`
403+
- **Purpose**: Validates encryption configuration for Bedrock Knowledge Base.
404+
- **Structure**:
405+
```json
406+
{
407+
"deploy": "true|false",
408+
"accounts": ["account_id1", "account_id2"],
409+
"regions": ["region1", "region2"],
410+
"input_params": {}
411+
}
412+
```
413+
414+
### `pBedrockKBS3BucketRuleParams`
415+
- **Purpose**: Validates S3 bucket configuration for Bedrock Knowledge Base.
416+
- **Structure**:
417+
```json
418+
{
419+
"deploy": "true|false",
420+
"accounts": ["account_id1", "account_id2"],
421+
"regions": ["region1", "region2"],
422+
"input_params": {
423+
"check_retention": "true|false",
424+
"check_encryption": "true|false",
425+
"check_access_logging": "true|false",
426+
"check_object_locking": "true|false",
427+
"check_versioning": "true|false"
428+
}
429+
}
430+
```
431+
432+
### `pBedrockKBVectorStoreSecretRuleParams`
433+
- **Purpose**: Validates secret configuration for Bedrock Knowledge Base.
434+
- **Structure**:
435+
```json
436+
{
437+
"deploy": "true|false",
438+
"accounts": ["account_id1", "account_id2"],
439+
"regions": ["region1", "region2"],
440+
"input_params": {}
441+
}
442+
```
443+
444+
### `pBedrockKBOpenSearchEncryptionRuleParams`
445+
- **Purpose**: Validates encryption configuration for Bedrock Knowledge Base.
446+
- **Structure**:
447+
```json
448+
{
449+
"deploy": "true|false",
450+
"accounts": ["account_id1", "account_id2"],
451+
"regions": ["region1", "region2"],
452+
"input_params": {}
453+
}
454+
```
455+
370456
---
371457
## References
372458
- [AWS SRA Generative AI Deep-Dive](https://docs.aws.amazon.com/prescriptive-guidance/latest/security-reference-architecture/gen-ai-sra.html)
@@ -375,3 +461,32 @@ This section explains the parameters in the CloudFormation template that require
375461
- [CloudWatch Metrics and Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html)
376462
- [AWS Lambda](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html)
377463
- [AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html)
464+
465+
## Related Security Control Solutions
466+
467+
This solution works in conjunction with other AWS SRA solutions to provide comprehensive safeguards for Bedrock GenAI environments:
468+
469+
### Amazon Bedrock Guardrails Solution
470+
The [SRA Bedrock Guardrails solution](../../genai/bedrock_guardrails/README.md) provides automated deployment of Amazon Bedrock Guardrails across your organization. It supports:
471+
472+
- **Content Filters**: Block harmful content in inputs/outputs based on predefined categories (Hate, Insults, Sexual, Violence, Misconduct, Prompt Attack)
473+
- **Denied Topics**: Define and block undesirable topics
474+
- **Word Filters**: Block specific words, phrases, and profanity
475+
- **Sensitive Information Filters**: Block or mask PII and sensitive data
476+
- **Contextual Grounding**: Detect and filter hallucinations based on source grounding
477+
478+
The solution uses KMS encryption for enhanced security and requires proper IAM role configurations for users who need to invoke or manage guardrails.
479+
480+
### GuardDuty Malware Protection for S3
481+
The [SRA GuardDuty Malware Protection solution](../../guardduty/guardduty_malware_protection_for_s3/README.md) helps protect S3 buckets used in your Bedrock environment from malware. This is particularly important for:
482+
483+
- Model evaluation job buckets
484+
- Knowledge base data ingestion buckets
485+
- Model invocation logging buckets
486+
487+
The solution enables GuardDuty's malware scanning capabilities to detect malicious files that could be used in prompt injection attacks or compromise your GenAI applications.
488+
489+
These complementary solutions work together to provide defense-in-depth for your Bedrock GenAI environment:
490+
- This solution (SRA Bedrock Org) provides organizational safeguards and monitoring
491+
- Bedrock Guardrails solution provides content and data safeguards
492+
- GuardDuty Malware Protection ensures S3 bucket security against malware threats

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_cloudwatch_endpoints/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import json
1112
import logging
1213
import os

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_eval_job_bucket/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import ast
1112
import logging
1213
import os

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_guardrail_encryption/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import json
1112
import logging
1213
import os

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_guardrails/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import ast
1112
import json
1213
import logging

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_iam_user_access/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import json
1112
import logging
1213
import os

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_invocation_log_cloudwatch/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import json
1112
import logging
1213
import os

aws_sra_examples/solutions/genai/bedrock_org/lambda/rules/sra_bedrock_check_invocation_log_s3/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
SPDX-License-Identifier: MIT-0
99
"""
10+
1011
import json
1112
import logging
1213
import os

0 commit comments

Comments
 (0)