Commit faa01c9
feat: Make Bedrock embedding credentials optional and add IAM support (#595)
## Summary
- Make AWS credentials optional for Bedrock embeddings
- Add IAM authentication support alongside explicit credentials
- Add custom endpoint URL support for Bedrock
- Clean up test files from S3 ambient credentials feature
## Changes Made
### Core Bedrock Improvements
- **Optional credentials**: `aws_access_key_id` and
`aws_secret_access_key` now default to `None`
- **Authentication methods**: New `access_method` field supports:
- `"credentials"`: Explicit AWS key/secret (existing behavior)
- `"iam"`: Uses AWS credential chain (environment vars, profiles, IAM
roles)
- **Custom endpoints**: New `endpoint_url` field for custom Bedrock
endpoints
- **Enhanced validation**: Proper validation logic for different
authentication methods
### Code Quality
- Remove leftover test files from S3 ambient credentials feature
- Clean up emoticons from test and utility files per project standards
### Backwards Compatibility
- All existing credential workflows continue to work unchanged
- Default `access_method="credentials"` maintains existing behavior
- No breaking changes to existing configurations
## Usage Examples
### IAM-based authentication (new):
```python
config = BedrockEmbeddingConfig(
access_method="iam", # Uses AWS credential chain
region_name="us-east-1",
model_name="amazon.titan-embed-text-v2"
)
```
### Traditional credentials (unchanged):
```python
config = BedrockEmbeddingConfig(
access_method="credentials",
aws_access_key_id="AKIAEXAMPLE",
aws_secret_access_key="secret123",
region_name="us-west-2"
)
```
### Custom endpoint support (new):
```python
config = BedrockEmbeddingConfig(
access_method="iam",
endpoint_url="https://bedrock.custom-region.amazonaws.com",
region_name="custom-region"
)
```
## Test plan
- [ ] Verify existing credential-based authentication still works
- [ ] Test IAM-based authentication with environment variables
- [ ] Test IAM-based authentication with AWS profiles
- [ ] Test IAM-based authentication with EC2 instance roles
- [ ] Test custom endpoint URL functionality
- [ ] Verify error handling for invalid access methods
- [ ] Confirm backwards compatibility with existing configs
🤖 Generated with [Claude Code](https://claude.ai/code)
---------
Co-authored-by: Claude <[email protected]>1 parent dbc85eb commit faa01c9
File tree
4 files changed
+69
-7
lines changed- test/integration/connectors
- unstructured_ingest
- embed
4 files changed
+69
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
1 | 5 | | |
2 | 6 | | |
3 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
64 | 77 | | |
65 | 78 | | |
66 | 79 | | |
| |||
96 | 109 | | |
97 | 110 | | |
98 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
99 | 126 | | |
100 | 127 | | |
101 | 128 | | |
| |||
113 | 140 | | |
114 | 141 | | |
115 | 142 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 143 | + | |
119 | 144 | | |
120 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
121 | 167 | | |
122 | 168 | | |
123 | 169 | | |
| |||
0 commit comments