Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apigw-lambda-bedrock-nova-terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lambda-layer/
lambda_function.zip
28 changes: 14 additions & 14 deletions apigw-lambda-bedrock-nova-terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,22 @@ Key components:

## Testing

Using Curl:
Using Curl:

```
curl -X POST \
-H "Content-Type: application/json" \
-d '{"prompt": "What are the key benefits of using AWS services?"}' \
https://YOUR-API-ENDPOINT/dev/generate_content

```
```sh
curl -X POST \
-H "Content-Type: application/json" \
-d '{"prompt": "What are the key benefits of using AWS services?"}' \
https://YOUR-API-ENDPOINT/dev/generate_content
```

## Viewing Test Results
```
{
"generated-text": "<Model generated response>"
}
```

```json
{
"generated-text": "<Model generated response>"
}
```

## Cleanup

Expand Down Expand Up @@ -133,4 +133,4 @@ Key components:
----
Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: MIT-0
SPDX-License-Identifier: MIT-0
4 changes: 2 additions & 2 deletions apigw-lambda-bedrock-nova-terraform/api_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ resource "aws_api_gateway_integration" "lambda_integration" {
rest_api_id = aws_api_gateway_rest_api.generate_content_api.id
resource_id = aws_api_gateway_resource.generate_content.id
http_method = aws_api_gateway_method.generate_content_post.http_method

integration_http_method = "POST"
type = "AWS_PROXY"
uri = aws_lambda_function.content_generation.invoke_arn
}

resource "aws_api_gateway_deployment" "api_deployment" {
rest_api_id = aws_api_gateway_rest_api.generate_content_api.id

depends_on = [
aws_api_gateway_integration.lambda_integration
]
Expand Down
22 changes: 11 additions & 11 deletions apigw-lambda-bedrock-nova-terraform/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ resource "aws_lambda_layer_version" "boto3_bedrock_layer" {
}

resource "aws_lambda_function" "content_generation" {
filename = "${path.module}/lambda_function.zip"
function_name = "ContentGenerationFunction"
role = aws_iam_role.lambda_role.arn
handler = "bedrock_integration.lambda_handler"
runtime = "python3.10"
architectures = ["arm64"]
layers = [aws_lambda_layer_version.boto3_bedrock_layer.arn]
memory_size = 256
timeout = 30
filename = "${path.module}/lambda_function.zip"
function_name = "ContentGenerationFunction"
role = aws_iam_role.lambda_role.arn
handler = "bedrock_integration.lambda_handler"
runtime = "python3.10"
architectures = ["arm64"]

layers = [aws_lambda_layer_version.boto3_bedrock_layer.arn]

memory_size = 256
timeout = 30

environment {
variables = {
Expand Down