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

Commit

Permalink
chore: lambda optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrunk committed May 31, 2024
1 parent 87b774d commit d8bff3d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Language,
Library,
ModelLanguage,
NodeVersion,
TypeSafeApiProject,
} from "@aws/pdk/type-safe-api";
import { javascript } from "projen";
Expand Down Expand Up @@ -79,6 +80,7 @@ const descriptiongenerator = new TypeSafeApiProject({
"@aws-lambda-powertools/logger@^2.1.0",
"fast-xml-parser@^4.3.6",
],
runtimeVersion: NodeVersion.NODE_20,
prettier: true,
license: "MIT-0",
copyrightOwner: "Amazon.com Inc. or its affiliates",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ The following table provides a sample cost breakdown for deploying this solution
| **AWS Service** | **Dimensions** | **Cost [USD]** |
|:--------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
| 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 |
| 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 |
| 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 |
| 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 |
| AWS API Gateway | 60 requests per hour | 0.15 |
| Amazon CloudWatch | 15 metrics using 5 GB data ingested for logs | 7.02 |
| AWS X-Ray | 100,000 requests per month through API Gateway and Lambda calls | 0.50 |
| Amazon Cognito | 10 demo users | 0.00 |
| AWS Web Application Firewall | 43,200 requests per month using the AWS Managed Rule Group | 6.03 |
| Amazon CloudFront | Demo UI hosting. The first 10 million requests/month and 1,024 GB/month are free | 0.00 |
| **Total monthly infrastructure cost** | | **95.38** |
| **Total monthly infrastructure cost** | | **91.36** |

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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class ComawsgenproductdescriptionDescriptionGenerator extends Construct {
environment: {
IMAGE_BUCKET: props.imageBucket.bucketName,
},
memorySize: 512,
memorySize: 128,
architecture: lambda.Architecture.ARM_64,
},
);
Expand Down

0 comments on commit d8bff3d

Please sign in to comment.