Small bash scripts for experimenting with Amazon Bedrock from the command line.
The project keeps two workflows separate on purpose:
generate-image.shfor image generation with Amazon Nova Canvasgenerate-text.shfor text generation with Amazon Nova 2 Lite
That split keeps the model contracts explicit and avoids mixing image-generation payloads with text-generation payloads.
- sequential output naming for generated files
- separate scripts for image and text model families
- shell-based tests that do not make live Bedrock calls
- Git Bash support on Windows
- minimal dependencies and no framework setup
- macOS, Linux, or Windows with Git Bash
bash- AWS CLI installed
- Bedrock model access enabled in your AWS account
- AWS credentials configured locally
jqbase64
- Install and verify the required tools.
On Windows, use Git Bash.
command -v bash
command -v aws
command -v jq
command -v base64
command -v mktempWindows install example:
winget install --id Git.Git -e
winget install --id Amazon.AWSCLI -e
winget install --id jqlang.jq -eIf you use Chocolatey instead of winget:
choco install git awscli jq- Configure your AWS credentials if needed.
aws configure- Make sure your account can invoke the models used by these scripts.
amazon.nova-canvas-v1:0- a Nova 2 Lite inference profile such as
us.amazon.nova-2-lite-v1:0
- Run one of the generators.
./generate-image.sh "A green parrot sitting on a tree branch, tropical jungle, photorealistic, high detail"
./generate-text.sh "Summarize the main differences between REST and GraphQL."Optional flags:
--regionto override the default AWS region--output-dirto choose where generated files are written--no-openon the image script to skip opening the output file--debugto preserve temp request/response files and print their paths
You can configure the scripts with environment variables instead of passing everything on the command line.
Common:
AWS_REGION
Image generation:
MODEL_ID
Text generation:
TEXT_INFERENCE_PROFILE_IDMODEL_IDas an explicit advanced override
Precedence for region:
--regionAWS_REGION- built-in default
us-east-1
Example:
export AWS_REGION=us-west-2
export TEXT_INFERENCE_PROFILE_ID=us.amazon.nova-2-lite-v1:0See .env.example for a minimal template.
.
├── generate-image.sh
├── generate-text.sh
├── images/
├── texts/
└── tests/
Generate an image with Amazon Nova Canvas:
./generate-image.sh "A green parrot sitting on a tree branch, tropical jungle, photorealistic, high detail"
./generate-image.sh --region us-west-2 --output-dir ./tmp-images --no-open "A studio portrait of a red fox"
./generate-image.sh --debug --no-open "A watercolor portrait of a blue jay"What it does:
- sends the prompt to
amazon.nova-canvas-v1:0 - saves the result under
images/asimage-0001.png,image-0002.png, and so on - opens the generated image automatically when a supported OS opener is available
Generate text with Amazon Nova 2 Lite:
./generate-text.sh "Summarize the main differences between REST and GraphQL."
./generate-text.sh --region us-west-2 --output-dir ./tmp-texts "Write a short markdown summary of REST vs GraphQL."
./generate-text.sh --debug "Write a markdown summary of event-driven architecture."What it does:
- sends the prompt through the configured Nova 2 Lite inference profile
- saves the result under
texts/asresponse-0001.md,response-0002.md, and so on - prints the generated response to the terminal
Configuration notes:
- by default the script uses
us.amazon.nova-2-lite-v1:0 - you can override it with
TEXT_INFERENCE_PROFILE_ID - the value should be the inference profile ID or ARN used for Nova 2 Lite
- the script still accepts
MODEL_IDas an explicit override, but the normal path is to use an inference profile
Image prompt example:
A green parrot sitting on a tree branch, tropical jungle, photorealistic, high detail
Text prompt example:
Summarize the main differences between REST and GraphQL in plain English.
Run the test scripts:
./tests/test-generate-image.sh
./tests/test-generate-text.shThe tests mock the aws command, so they do not make live Bedrock calls.
Common commands:
make help
make check
make test
make test-image
make test-textWhat they do:
make helpshows the available targetsmake checkruns shell syntax checksmake testruns the full test suitemake test-imageruns only the image script testsmake test-textruns only the text script tests
- Missing Bedrock access: if the AWS CLI is configured but the Bedrock call still fails, verify model access in the Bedrock console for the selected region.
- Inference profile errors: Nova 2 Lite may require an inference profile instead of direct on-demand invocation. Set
TEXT_INFERENCE_PROFILE_IDif needed. The script defaults tous.amazon.nova-2-lite-v1:0. - Headless servers: on EC2 or other non-GUI machines, the image script still saves the PNG and prints its full path even if nothing opens automatically.
- Windows Git Bash: use Git Bash for the current scripts. Verify
aws,jq,base64, andmktempare available there.
- default region is
us-east-1 - output folders such as
images/andtexts/are ignored by Git - each script validates the model ID so image and text requests do not get mixed up
- as of March 25, 2026, Nova 2 Lite may require an inference profile instead of direct on-demand invocation in some Bedrock setups
- Windows support targets Git Bash; PowerShell would require separate scripts
This project is licensed under the MIT License. See LICENSE.
For issues or inquiries, feel free to contact the maintainer:
- Name: Rod Oliveira
- Role: Software Developer
- Email: jrodolfo@gmail.com
- GitHub: https://github.com/jrodolfo
- LinkedIn: https://www.linkedin.com/in/rodoliveira
- Webpage: https://jrodolfo.net