mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-21 13:58:15 +00:00
feat: Enhance Bedrock authentication with improved docs, validation, and tests
- Add clearer authentication method comments in documentation examples - Include security best practices for API key usage - Add CLI validation hints for AWS Bedrock API key format - Implement comprehensive error handling tests (timeout, rate limit, invalid key) - Add connection error and retry scenario test cases - Maintain consistency between English and Portuguese documentation Addresses AI code review feedback on PR #3126 Co-Authored-By: Jo\u00E3o <joao@crewai.com>
This commit is contained in:
@@ -328,12 +328,14 @@ In this section, you'll find detailed examples that help you select, configure,
|
||||
|
||||
Example usage in your CrewAI project:
|
||||
```python Code
|
||||
# Using IAM role authentication
|
||||
# Method 1: IAM Role Authentication (uses AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)
|
||||
# Set environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION
|
||||
llm = LLM(
|
||||
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
|
||||
)
|
||||
|
||||
# Using API key authentication
|
||||
# Method 2: API Key Authentication (uses AWS_BEARER_TOKEN_BEDROCK)
|
||||
# Set environment variables: AWS_BEARER_TOKEN_BEDROCK, AWS_DEFAULT_REGION
|
||||
llm = LLM(
|
||||
model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0"
|
||||
)
|
||||
@@ -344,6 +346,13 @@ In this section, you'll find detailed examples that help you select, configure,
|
||||
- For API key authentication, you can generate a 30-day API key from the [Amazon Bedrock console](https://console.aws.amazon.com/bedrock/)
|
||||
- For production applications, use IAM roles or temporary credentials instead of long-term API keys
|
||||
|
||||
**Security Best Practices:**
|
||||
- API keys expire after 30 days and should be rotated regularly
|
||||
- Use IAM roles for production environments for better security
|
||||
- Store API keys securely and never commit them to version control
|
||||
- Monitor API usage and set up alerts for unusual activity
|
||||
- Consider using temporary credentials for enhanced security
|
||||
|
||||
[Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) is a managed service that provides access to multiple foundation models from top AI companies through a unified API, enabling secure and responsible AI application development.
|
||||
|
||||
| Model | Context Window | Best For |
|
||||
|
||||
Reference in New Issue
Block a user