Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit d8bff3d

Browse files
committed
chore: lambda optimization
1 parent 87b774d commit d8bff3d

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.projenrc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
Language,
77
Library,
88
ModelLanguage,
9+
NodeVersion,
910
TypeSafeApiProject,
1011
} from "@aws/pdk/type-safe-api";
1112
import { javascript } from "projen";
@@ -79,6 +80,7 @@ const descriptiongenerator = new TypeSafeApiProject({
7980
"@aws-lambda-powertools/logger@^2.1.0",
8081
"fast-xml-parser@^4.3.6",
8182
],
83+
runtimeVersion: NodeVersion.NODE_20,
8284
prettier: true,
8385
license: "MIT-0",
8486
copyrightOwner: "Amazon.com Inc. or its affiliates",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ The following table provides a sample cost breakdown for deploying this solution
1818
| **AWS Service** | **Dimensions** | **Cost [USD]** |
1919
|:--------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
2020
| Amazon Bedrock | 60 requests per hour with an average of five 1 megapixel images as context(6,000 input tokens and 200 output tokens). **Anthropic Claude 3 Haiku** | 75.60 |
21-
| AWS Lambda | 60 requests per hour through 1 Lambda function with 512 MB of memory allocated and arm64 CPU and an average run time of 15 seconds = 43,200 requests per month | 4.39 |
21+
| AWS Lambda | 60 requests per hour through 1 Lambda function with 128 MB of memory allocated and arm64 CPU and an average run time of 5 seconds = 43,200 requests per month | 0.37 |
2222
| Amazon Simple Storage Service | 5 product images added every minute with an average size of 1 MB with expiration after 3 days = 21.6 GB per month in S3 Standard Storage and static website hosting | 1.76 |
2323
| AWS API Gateway | 60 requests per hour | 0.15 |
2424
| Amazon CloudWatch | 15 metrics using 5 GB data ingested for logs | 7.02 |
2525
| AWS X-Ray | 100,000 requests per month through API Gateway and Lambda calls | 0.50 |
2626
| Amazon Cognito | 10 demo users | 0.00 |
2727
| AWS Web Application Firewall | 43,200 requests per month using the AWS Managed Rule Group | 6.03 |
2828
| Amazon CloudFront | Demo UI hosting. The first 10 million requests/month and 1,024 GB/month are free | 0.00 |
29-
| **Total monthly infrastructure cost** | | **95.38** |
29+
| **Total monthly infrastructure cost** | | **91.36** |
3030

3131
The prototype allows you to select which model to use. The following table shows an estimated cost for each model assuming the dimensions in the above table. Anthropic Claude 3 Haiku is the default and is listed above.
3232

packages/infra/main/src/constructs/apis/comawsgenproductdescriptiondescriptiongenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class ComawsgenproductdescriptionDescriptionGenerator extends Construct {
7373
environment: {
7474
IMAGE_BUCKET: props.imageBucket.bucketName,
7575
},
76-
memorySize: 512,
76+
memorySize: 128,
7777
architecture: lambda.Architecture.ARM_64,
7878
},
7979
);

0 commit comments

Comments
 (0)