From 07e344db12f366a572c37b662661927214107b84 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 26 Oct 2025 21:46:12 +0900 Subject: [PATCH 1/3] apigw-bedrock-nova-canvas: Fix deprecated name argument of aws_region data source --- apigw-bedrock-nova-canvas/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apigw-bedrock-nova-canvas/main.tf b/apigw-bedrock-nova-canvas/main.tf index 7180f01ae..7460b76dd 100644 --- a/apigw-bedrock-nova-canvas/main.tf +++ b/apigw-bedrock-nova-canvas/main.tf @@ -36,7 +36,7 @@ resource "aws_iam_policy" "invoke_model_policy" { ] Effect = "Allow" Resource = [ - "arn:aws:bedrock:${data.aws_region.current.name}::foundation-model/amazon.nova-canvas-v1:0" + "arn:aws:bedrock:${data.aws_region.current.region}::foundation-model/amazon.nova-canvas-v1:0" ] }, ] From 0013d142f3597bb21351e209a90b6d516bbbbb73 Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 26 Oct 2025 21:46:43 +0900 Subject: [PATCH 2/3] apigw-bedrock-nova-canvas: terraform fmt --- apigw-bedrock-nova-canvas/main.tf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apigw-bedrock-nova-canvas/main.tf b/apigw-bedrock-nova-canvas/main.tf index 7460b76dd..0646d0c3e 100644 --- a/apigw-bedrock-nova-canvas/main.tf +++ b/apigw-bedrock-nova-canvas/main.tf @@ -15,10 +15,10 @@ resource "random_string" "suffix" { # Create Lambda layer for Pillow from provided zip file resource "aws_lambda_layer_version" "pillow_layer" { - filename = "pillow.zip" # Make sure this zip file exists in your terraform directory - layer_name = "pillow_layer" + filename = "pillow.zip" # Make sure this zip file exists in your terraform directory + layer_name = "pillow_layer" compatible_runtimes = ["python3.11"] - description = "Pillow library layer for image processing" + description = "Pillow library layer for image processing" } # IAM Policy for invoking Bedrock model @@ -45,7 +45,7 @@ resource "aws_iam_policy" "invoke_model_policy" { # S3 bucket for storing images resource "aws_s3_bucket" "image_bucket" { - bucket = "${lower(var.prefix)}-image-bucket-${random_string.suffix.result}" + bucket = "${lower(var.prefix)}-image-bucket-${random_string.suffix.result}" force_destroy = true } @@ -53,7 +53,7 @@ resource "aws_s3_bucket" "image_bucket" { resource "aws_cloudwatch_log_group" "lambda_log_group" { name = "/aws/lambda/${lower(var.prefix)}-invoke-bedrock" retention_in_days = 14 - + lifecycle { prevent_destroy = false } @@ -61,7 +61,7 @@ resource "aws_cloudwatch_log_group" "lambda_log_group" { # Lambda function resource "aws_lambda_function" "invoke_bedrock_function" { - filename = "index.zip" # Replace with your Lambda code zip file + filename = "index.zip" # Replace with your Lambda code zip file function_name = "${lower(var.prefix)}-invoke-bedrock" role = aws_iam_role.lambda_role.arn handler = "index.handler" @@ -146,7 +146,7 @@ resource "aws_api_gateway_integration" "lambda_integration" { # API Gateway Deployment resource "aws_api_gateway_deployment" "api_deployment" { rest_api_id = aws_api_gateway_rest_api.bedrock_api.id - + depends_on = [ aws_api_gateway_integration.lambda_integration ] @@ -176,12 +176,12 @@ output "lambda_function" { output "api_endpoint" { description = "The API Gateway endpoint URL " - value = "${aws_api_gateway_stage.api_stage.invoke_url}/image_gen" + value = "${aws_api_gateway_stage.api_stage.invoke_url}/image_gen" } output "s3_image_bucket" { description = "The Output S3 bucket is " - value = aws_s3_bucket.image_bucket.id + value = aws_s3_bucket.image_bucket.id } # Data source for current region From 14fc88e1c518574fb72e2b58d75f2402679b201c Mon Sep 17 00:00:00 2001 From: kakakakakku Date: Sun, 26 Oct 2025 22:15:42 +0900 Subject: [PATCH 3/3] apigw-bedrock-nova-canvas: Fix README.md --- apigw-bedrock-nova-canvas/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apigw-bedrock-nova-canvas/README.md b/apigw-bedrock-nova-canvas/README.md index 35f30ffaf..878d2ea0d 100644 --- a/apigw-bedrock-nova-canvas/README.md +++ b/apigw-bedrock-nova-canvas/README.md @@ -22,8 +22,6 @@ Important: this application uses various AWS services and there are costs associ For this pattern, you would need access only to Amazon Nova Canvas foundation model (Model ID: amazon.nova-canvas-v1:0) in us-east-1 region, since the pattern uses us-east-1 region by default. -You must request access to the model before you can use it. If you try to use the model before you have requested access to it, you will receive an error message. - 1. Create a new directory, navigate to that directory in a terminal and clone the GitHub repository: ``` git clone https://github.com/aws-samples/serverless-patterns @@ -86,4 +84,4 @@ You must request access to the model before you can use it. If you try to use th ---- Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. -SPDX-License-Identifier: MIT-0 \ No newline at end of file +SPDX-License-Identifier: MIT-0