Generate and store images in S3 using Titan Image Generator G1
A quickstart guide on deploying a SAM app that stores Bedrock images in S3 and creates logs in CloudWatch.

Hello World Example
in SAM makes it easy to spin up a template.yaml
for me to use as a basis to connect all the AWS services. I also enabled structured logging in JSON for my Lambda functions for CloudWatch.s3imagegenerator
in my SAM app for the new Lambda, then added my app.py
file. 'text'
and 'seed'
values from the event object. Afterwards, it then calls a function that constructs a request to Bedrock with these parameters. I'll get a base64-encoded image in the response, but then I need to decode it into binary, so it'll upload into S3 under a dynamically generated object key. CloudWatch will log each step I just outlined.template.yaml
and start putting together the AWS services I'll be using (Lambda, S3, CloudWatch, Bedrock).sam build
and sam deploy
. response.json
, but it's unclear. Finally, I open CloudWatch and see this: "log_level": "ERROR", "errorMessage": "Unknown service: 'bedrock-runtime'
requirements.txt
file in my s3imagegenerator
directory with the latest version: boto3==1.34.27
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.