AWS Bedrock Setup
Enable AWS Bedrock services for AI image generation in your platform
AWS Bedrock Setup
To enable the image generation features in your AI SaaS platform, you need to set up AWS Bedrock and request access to the Amazon Titan Image Generator v2 model. This guide will walk you through the process step by step.
Prerequisites
Before proceeding, ensure you have:
- Deployed your core infrastructure successfully
- Access to your AWS account with administrator privileges
- Updated your
.env
file with the AWS Bedrock region
Setting up AWS Bedrock
Verify Environment Variables
First, check that the AWS Bedrock region is properly set in your .env
file in the cdk
directory:
You should have already set this variable during the initial configuration. The Titan Image Generator v2 model is primarily available in the us-east-1 (N. Virginia) region, which is why we specify this region separately from your deployment region.
If this environment variable is missing, add it now before proceeding. The image generation services will not work without the correct region configuration.
Access AWS Bedrock Console
- Log in to the AWS Management Console
- Make sure you're in the US East (N. Virginia) - us-east-1 region by checking the region selector in the upper right corner
- Search for "Bedrock" in the search bar and select it
- If this is your first time accessing Bedrock, you'll see a welcome screen
- Click "Get started" to proceed
If you've never used AWS Bedrock before, you'll need to complete an initial setup process.
Navigate to Model Access
- In the AWS Bedrock console, scroll down the left sidebar until you find the "Bedrock configuration" section
- Click on "Model access" under this section
- You'll see a table of available foundation models categorized by provider
- Look for the "Amazon" section in the table
- You can either scroll down to find "Titan Image Generator G1 v2" or use the search bar to find it
Request Access to Amazon Titan Image Generator v2
- In the "Access status" column next to "Titan Image Generator G1 v2", click on "Available to request"
- A side panel will appear - click on "Request model access"
- Scroll down in the panel and click the "Next" button
- Review the information and click the "Submit" button
You'll be redirected back to the base models list table after submitting your request.
Verify Access Status
- After a few minutes, refresh the model access page
- Check the "Access status" column for "Titan Image Generator G1 v2"
- The status should change from "Available to request" to "Access granted"
- If the status doesn't update immediately, wait a few more minutes and refresh again
If your access request is not approved within 30 minutes, check that your AWS account is in good standing and has the necessary permissions.
Redeploy Your Infrastructure
Now that you have access to the required Bedrock model and have updated your environment variables, redeploy your infrastructure:
This deployment will update your Lambda functions with the AWS_BEDROCK_REGION environment variable, allowing them to connect to the correct region for image generation services.
Verifying Bedrock Integration
After deploying with AWS Bedrock configuration, it's important to verify that the image generation service is working correctly:
Access Your AI Services
- Navigate to your application URL
- Sign in to your account
- Go to the AI Services section
- Select the "Image Generation" service
Test Image Generation
- Enter a descriptive prompt (e.g., "A scenic mountain landscape with a lake")
- Select image size and other available options
- Click "Generate"
- Verify that the image is generated successfully
The generation process typically takes 5-10 seconds. If successful, you'll see the generated image displayed in the interface.
Check Credit Usage
- After generating an image, check your credit balance
- Verify that credits were deducted according to the service pricing configuration
Troubleshooting
If you encounter issues with the image generation service, check the following:
- Region Configuration: Ensure
AWS_BEDROCK_REGION
is set tous-east-1
in your.env
file - Access Status: Verify that access to Amazon Titan Image Generator G1 is still granted in the Bedrock console
- Lambda Logs: Check CloudWatch logs for any errors in the image generation Lambda function
Next Steps
Now that you've configured AWS Bedrock for image generation, proceed to OpenAI Setup to enable additional AI services with OpenAI's models.