This solution contains a serverless backend and ReactJS front-end application which creates product descriptions from images and text input, enhances and translates product descriptions using the new managed generative AI service, Amazon Bedrock.
Retail businesses often have many thousands or millions of products, all of which require accurate and effective descriptions. Retailers often have existing metadata or images for these products that can be provided as inputs to generative AI models to greatly accelerate the process of creating product descriptions.
You are responsible for the cost of the AWS services used while running this Guidance. As of November 2023, the cost for running this Guidance with the default settings in the US East (N. Virginia) is approximately $86 per month for processing 1000 products each month.
This guidance includes the AWS services Rekognition, Bedrock, Cognito, Lambda, API Gateway and CloudWatch with costs as follow:
Conservatively (erring on the side of overestimating), using this solution to generate product descriptions based on input images 1000 times per month (including generating translations into Spanish, German, and French), and assuming a worst case of 30s per Lambda function invocation and 1000 input/output tokens for all calls to Claude Instant and Jurassic models, costs would be approximately as follows:
You'll need to install all prerequisites on your local machine:
cdk
command) as documented here. You will also need to run cdk bootstrap
if you haven't used the CDK before in your account as discussed here.NOTE: Docker must be installed and running. You can ensure that the Docker daemon is running by ensuring that a command like docker ps
runs without error. If no containers are running, then docker ps
should return an empty list of containers like this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Create an EC2 environment in AWS Cloud9, launch the EC2 instance into a public subnet, and write down its Public IPv4 address (#cloud9_ec2_ip).
Resize the EBS volume that the environment (created in Step 1) uses to at least 20GB. It comes with 10GB for t2.micro by default.
Clone the repo:
git clone https://github.com/aws-solutions-library-samples/guidance-for-generating-product-descriptions-with-bedrock.git
cd to the repo folder:
cd guidance-for-generating-product-descriptions-with-bedrock
(Optional) create a new Python virtualenv for project-specific dependencies:
python -m venv .env && source .env/bin/activate
Install CDK dependencies:
pip install -r deployment/requirements.txt
Bootstrapping for AWS CDK, if it has not been done previously:
cd deployment && cdk bootstrap
Deploy the backend:
cd deployment && cdk deploy
cd back to the project root:
cd ..
Create an initial Cognito user:
deployment/create-user.sh <>
Update config.js
with the appropriate values from CDK stack outputs. This can be done automatically by running
deployment/update-config.sh
Install frontend dependencies:
cd source/frontend && npm install
Run the sample client app, and write down the port number (#web_port) that the webpack listens to, ex. 8080.
npm start
Open the Security Groups of the EC2 created in Step 1, add an inbound rule, which allows Custom TCP, Port range #web_port, Source “My IP”, then Save rules.
The deployment should be successful if all of the above commands complete without error. You can browse the backend resources created by navigating to the CloudFormation service in the AWS Console, finding the stack named LambdaStack
, and browsing its resources.
You can try the demo web app by following these steps:
See the Bedrock product page for more resources on using Amazon Bedrock.
The provisioned infrastructure can be deleted by running the following command:
cd deployment && cdk destroy
Additional considerations and limitations