- AWS CLI, SAM CLI, Python 3.13+
- Existing: S3 bucket, SQS queue, Bedrock Agent with GitHub MCP tools
# 1. Configure
cp .env.example .env
# Edit .env with: AGENT_RUNTIME_ARN, STORAGE_BUCKET_NAME, SQS_QUEUE_ARN
# 2. Deploy
bin/deploy.sh # Interactive - prompts for environment
bin/deploy.sh dev # Deploy to dev (uses .env or .env.dev)
bin/deploy.sh qa # Deploy to qa (uses .env.qa)
bin/deploy.sh prod # Deploy to prod (uses .env.prod)# Check function
aws lambda get-function --function-name sqs-email-handler-dev
# View logs (send test email first)
aws logs tail /aws/lambda/sqs-email-handler-dev --followExpected logs:
- Agent invocation completed
- Lambda completes in up to 5 min (waits for agent response)
- Check GitHub for created issue
Each environment is fully isolated with its own CloudFormation stack.
| Resource | Naming Pattern |
|---|---|
| CloudFormation Stack | bedrock-agentcore-lambda-{env} |
| Lambda Function | sqs-email-handler-{env} |
| IAM Role | sqs-email-handler-role-{env} |
| S3 Deployment Prefix | bedrock-agentcore-lambda-{env} |
| S3 Attachment Path | attachments/{env}/{message-id}/ |
| S3 Prompt Path | prompts/{env}/{prompt-name} |
-
Create env file (e.g.,
.env.qa):cp .env.example .env.qa # Edit with environment-specific values -
Ensure SQS visibility timeout >= Lambda timeout (300s):
# Check current timeout aws sqs get-queue-attributes \ --queue-url https://sqs.us-west-2.amazonaws.com/ACCOUNT/QUEUE_NAME \ --attribute-names VisibilityTimeout # Update if needed (360s recommended) aws sqs set-queue-attributes \ --queue-url https://sqs.us-west-2.amazonaws.com/ACCOUNT/QUEUE_NAME \ --attributes VisibilityTimeout=360
-
Deploy:
bin/deploy.sh qa
dev- Development (default)qa- Quality Assuranceprod- Production (requires changeset confirmation)
Agent fails:
- Verify
AGENT_RUNTIME_ARNis correct - Check agent state is
PREPARED - Ensure Lambda role has
bedrock-agentcore:InvokeAgentRuntime
Lambda not triggered:
- Check IAM permissions (S3, SQS, Bedrock)
- Verify event source mapping exists
- Check SQS queue has messages
Update deployment: Re-run bin/deploy.sh after code changes
Delete stack:
aws cloudformation delete-stack --stack-name bedrock-agentcore-lambda-dev(Does not delete S3 bucket, SQS queue, or Bedrock agent)
Enable attachment uploads to include images/files in GitHub issues.
- S3 Bucket: Public bucket for attachments (separate from email bucket)
- CloudFront Distribution: Origin pointing to attachments bucket
Add to your .env file:
ATTACHMENTS_S3_BUCKET=your-attachments-bucket
ATTACHMENTS_CLOUDFRONT_DOMAIN=d1234567890.cloudfront.net
ATTACHMENT_MAX_SIZE_MB=20 # Optional, default: 20- Lambda extracts attachments from incoming emails
- Uploads to S3:
attachments/{env}/{message-id}/{filename} - Generates public CloudFront URLs
- URLs passed to Bedrock agent for inclusion in GitHub issues
Supported: images (PNG, JPEG, GIF), PDFs, CSVs, and other files up to 20 MB (configurable).