Skip to content

Commit 1d591ae

Browse files
fix: workshop (#51)
* fix: workshop SCP for listing bedrock models * fix: too few X's for temporary directory * fix: allow a variable to set the container platform * feat: bump versions for modules --------- Signed-off-by: Scott Schreckengaust <[email protected]>
1 parent 4b52e73 commit 1d591ae

File tree

12 files changed

+42
-32
lines changed

12 files changed

+42
-32
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
<!-- markdownlint-disable MD024 -->
11+
## [1.0.1]
12+
1013
### Added
1114

1215
- Bedrock Guardrails sample
1316

14-
<!-- markdownlint-disable MD024 -->
1517
## [1.0.0]
1618

1719
### Added

samples/bedrock-agent/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,26 @@ Do not forget to delete the resources to avoid unexpected charges.
165165
166166
1. First make sure to remove all data from the Amazon Simple Storage Service (Amazon S3) Bucket.
167167
168-
```shell
169-
aws s3 rb <DocBucket> --force
170-
```
168+
```shell
169+
aws s3 rb <DocBucket> --force
170+
```
171171
172172
2. Next, set the data source to retain to allow Terraform to destroy all the resources.
173-
174-
- open the console to the Bedrock Knowledge base
175-
- click the name of the knowledge base and verify the page shows the knowlege base id as output above <KBID>
176-
- click the data source and verify the data source id is the <DataSourceID> as above
177-
- click the edit button and expand "Advanced settings"
178-
- Change the data deletion policy from "Delete" to "Retain"
179-
- Click the submit button
173+
- open the console to the Bedrock Knowledge base
174+
- click the name of the knowledge base and verify the page shows the knowlege base id as output above <KBID>
175+
- click the data source and verify the data source id is the <DataSourceID> as above
176+
- click the edit button and expand "Advanced settings"
177+
- Change the data deletion policy from "Delete" to "Retain"
178+
- Click the submit button
180179
181180
3. Last remove all the resources.
182181
183-
```shell
184-
$ terraform destroy
185-
```
182+
```shell
183+
terraform destroy
184+
```
186185
187186
Delete all the associated logs created by the different services in Amazon CloudWatch logs
188187
189-
# Content Security Legal Disclaimer
188+
## Content Security Legal Disclaimer
189+
190190
The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.

samples/bedrock-agent/data.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
data "aws_bedrock_foundation_models" "test" {}
1+
# https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html
2+
# data "aws_bedrock_foundation_models" "test" {}

samples/bedrock-agent/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ provider "opensearch" {
1414
module "bedrock" {
1515
#checkov:skip=CKV_TF_1:Terraform registry has no ability to use a commit hash
1616
source = "aws-ia/bedrock/aws"
17-
version = "0.0.4"
17+
version = "0.0.5"
1818
create_kb = true
1919
create_default_kb = true
2020
create_agent = true
@@ -26,6 +26,7 @@ module "bedrock" {
2626
action_group_state = "ENABLED"
2727
lambda_action_group_executor = module.lambda.lambda_function_arn
2828
api_schema_payload = file("${path.module}/lambda/action-group.yaml")
29+
kb_embedding_model_arn = "arn:aws:bedrock:${var.region}::foundation-model/amazon.titan-embed-text-v1"
2930
}
3031

3132
module "lambda" {

samples/bedrock-agent/scripts/load-kb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ BOOKS_LIST=("https://www.gutenberg.org/ebooks/84.txt.utf-8"
2323
"https://www.gutenberg.org/ebooks/1513.txt.utf-8")
2424

2525
# make a temporary directory to download the books
26-
BOOKS_DIR=$(mktemp -d -t "books.$$")
26+
BOOKS_DIR=$(mktemp -d -t "books.$$.XXXXXX")
2727

2828
pushd "$BOOKS_DIR"
2929

samples/bedrock-agent/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ variable "foundation_model" {
3030
description = "The foundation model to use for the agent"
3131
nullable = false
3232
default = "anthropic.claude-3-haiku-20240307-v1:0"
33-
validation {
34-
condition = contains(data.aws_bedrock_foundation_models.test.model_summaries[*].model_id, var.foundation_model)
35-
error_message = "The foundational model is not found"
36-
}
33+
# validation {
34+
# condition = contains(data.aws_bedrock_foundation_models.test.model_summaries[*].model_id, var.foundation_model)
35+
# error_message = "The foundational model is not found"
36+
# }
3737
}

samples/bedrock-guardrails/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This example shows how to deploy a basic Bedrock agent with guardrails, leaving
55
## Overview
66

77
The AWS Terraform [bedrock](https://registry.terraform.io/modules/aws-ia/bedrock/aws/latest) module
8-
abstracts the complexity of orchestrating AWS services like for Bedrock's guardrails. This
8+
abstracts the complexity of orchestrating AWS services like for Bedrock's guardrails.
99

1010
## Folder Structure
1111

samples/bedrock-guardrails/data.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
data "aws_bedrock_foundation_models" "test" {}
1+
# data "aws_bedrock_foundation_models" "test" {}

samples/bedrock-guardrails/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module "bedrock_withoutguardrail" {
22
#checkov:skip=CKV_TF_1:Terraform registry has no ability to use a commit hash
33
source = "aws-ia/bedrock/aws"
4-
version = "0.0.4"
4+
version = "0.0.5"
55
create_kb = false
66
create_default_kb = false
77
create_s3_data_source = false
@@ -17,7 +17,7 @@ module "bedrock_withoutguardrail" {
1717
module "bedrock_withguardrail" {
1818
#checkov:skip=CKV_TF_1:Terraform registry has no ability to use a commit hash
1919
source = "aws-ia/bedrock/aws"
20-
version = "0.0.4"
20+
version = "0.0.5"
2121
create_kb = false
2222
create_default_kb = false
2323
create_s3_data_source = false

samples/bedrock-guardrails/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ variable "foundation_model" {
1919
description = "The foundation model to use for the agent"
2020
nullable = false
2121
default = "anthropic.claude-3-haiku-20240307-v1:0"
22-
validation {
23-
condition = contains(data.aws_bedrock_foundation_models.test.model_summaries[*].model_id, var.foundation_model)
24-
error_message = "The foundational model is not found"
25-
}
22+
# validation {
23+
# condition = contains(data.aws_bedrock_foundation_models.test.model_summaries[*].model_id, var.foundation_model)
24+
# error_message = "The foundational model is not found"
25+
# }
2626
}
2727

2828
# These are guardrail variables available within the Bedrock module and duplicated below for reference
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module "genai_doc_ingestion" {
22
#checkov:skip=CKV_TF_1:Terraform registry has no ability to use a commit hash
33
source = "aws-ia/genai-document-ingestion-rag/aws"
4-
version = "1.0.0"
4+
version = "1.0.1"
5+
56
solution_prefix = "doc-explorer"
6-
container_platform = "linux/amd64"
7+
container_platform = var.container_platform
78
force_destroy = true
89
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
variable "container_platform" {
2+
description = "The container platform"
3+
type = string
4+
default = "linux/amd64"
5+
}

0 commit comments

Comments
 (0)