@@ -9,100 +9,123 @@ AWS Bedrock is a fully managed generative AI service that simplifies building an
9
9
10
10
## Key Features
11
11
12
- ### Multi-Model Architecture
13
- - Access to cutting-edge models like Amazon Titan, Anthropic's Claude, and AI21 Labs' Jurassic-2
14
- - Enables comparative model testing without vendor lock-in
15
- - Supports specialized model selection for specific tasks
16
-
17
- ### Agents for Complex Workflow Automation
18
- - Connect to internal APIs and Lambda functions
19
- - Auto-generate API call sequences for user requests
20
- - Maintain session context for conversational interactions
21
-
22
- ### Advanced Data Processing
23
- - Multimodal data processing (PDFs, images, audio/video)
24
- - Automated data extraction with customizable output templates
25
- - Confidence scoring to reduce hallucinations
26
-
27
- ### Enterprise-Grade Security
28
- - AWS IAM integration for granular access control
29
- - Private model customization with dedicated compute
30
- - Data encryption at rest and in transit
31
- - Compliance with HIPAA, GDPR, and SOC standards
32
-
33
- ## Requirements
34
-
35
- | Name | Version |
36
- | ------| ---------|
37
- | Terraform | >= 0.13.0 |
38
- | AWS Provider | Latest Recommended Version |
12
+ - Budget Management for AI Resource Consumption
13
+ - Configurable Guardrails for Content Safety
14
+ - Multiple Inference Profiles for Different AI Models
15
+ - Flexible Tagging for Resource Management
39
16
40
17
## Usage Example
41
18
42
19
``` hcl
43
- module "aws_bedrock " {
20
+ module "bedrock " {
44
21
source = "DNXLabs/bedrock/aws"
45
-
46
- # Configure your Bedrock resources here
47
- # Example configurations will be added as the module develops
48
- }
49
- ```
50
-
51
- ## Terraform Integration Strategies
52
22
53
- ### IAM Configuration
54
- ``` hcl
55
- resource "aws_iam_role" "bedrock_execution" {
56
- name = "bedrock-exec-role"
57
-
58
- assume_role_policy = jsonencode({
59
- Version = "2012-10-17"
60
- Statement = [{
61
- Action = "sts:AssumeRole"
62
- Effect = "Allow"
63
- Principal = {
64
- Service = "bedrock.amazonaws.com"
23
+ # Budget Configuration
24
+ budget_email = "contact@example.com"
25
+ budget = 500 # Monthly budget in USD
26
+
27
+ # Guardrails Configuration
28
+ guardrails = [
29
+ {
30
+ name = "content-safety-guardrail"
31
+ description = "Prevent inappropriate content"
32
+ filter_strength = "MEDIUM"
33
+ filters = ["SEXUAL", "VIOLENCE", "HATE", "INSULTS", "MISCONDUCT", "PROMPT_ATTACK"]
34
+ tags = {
35
+ "Unit" = "Cloud Operations Centre"
65
36
}
66
- }]
67
- })
37
+ }
38
+ ]
39
+
40
+ # Inference Profiles for Different Models
41
+ profiles = [
42
+ {
43
+ name = "claude-3-5-sonnet-profile"
44
+ description = "Claude 3.5 Sonnet Inference Profile"
45
+ source_inference_model_name = "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
46
+ tags = {
47
+ "Unit" = "Cloud Operations Centre"
48
+ }
49
+ },
50
+ {
51
+ name = "claude-3-7-sonnet-profile"
52
+ description = "Claude 3.7 Sonnet Inference Profile"
53
+ source_inference_model_name = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
54
+ tags = {
55
+ "Unit" = "Cloud Operations Centre"
56
+ }
57
+ }
58
+ ]
68
59
}
69
- ```
70
60
71
- ### Supporting Infrastructure
72
- ``` hcl
73
- # S3 Bucket for model training data
74
- resource "aws_s3_bucket" "model_data" {
75
- bucket = "bedrock-training-data-${var.env}"
61
+ # Outputs
62
+ output "profile_arns" {
63
+ description = "ARNs of created Bedrock inference profiles"
64
+ value = module.bedrock.profile_arns
65
+ }
66
+
67
+ output "guardrail_arns" {
68
+ description = "ARNs of created Bedrock guardrails"
69
+ value = module.bedrock.guardrail_arns
76
70
}
77
71
78
- # Lambda function for custom model hooks
79
- resource "aws_lambda_function" "model_validation" {
80
- filename = "lambda.zip"
81
- function_name = "bedrock-model-validator"
82
- role = aws_iam_role.lambda_exec.arn
83
- handler = "index.handler"
84
- runtime = "python3.9"
72
+ output "guardrail_versions" {
73
+ description = "Versions of created Bedrock guardrails"
74
+ value = module.bedrock.guardrail_versions
85
75
}
86
76
```
87
77
88
- ## Best Practices
89
- 1 . Use the latest version of the module
90
- 2 . Implement proper IAM roles and permissions
91
- 3 . Configure comprehensive logging and monitoring
92
- 4 . Manage model versions across environments
93
- 5 . Optimize costs with intelligent scaling policies
78
+ <!-- - BEGIN_TF_DOCS --->
79
+
80
+ ## Requirements
81
+
82
+ | Name | Version |
83
+ | ------| ---------|
84
+ | Terraform | >= 0.13.0 |
85
+ | AWS Provider | 6.0.0-beta1 |
94
86
95
87
## Inputs
96
88
97
89
| Name | Description | Type | Default | Required |
98
90
| ------| -------------| ------| ---------| :--------:|
99
- | (Inputs to be dynamically populated) | | | | |
91
+ | ` budget_email ` | Email address to send budget alerts | ` string ` | n/a | yes |
92
+ | ` budget ` | Monthly budget for AI resources in USD | ` number ` | n/a | yes |
93
+ | ` guardrails ` | List of guardrail configurations | ` list(object({...})) ` | ` [] ` | no |
94
+ | ` profiles ` | List of inference profile configurations | ` list(object({...})) ` | ` [] ` | no |
100
95
101
96
## Outputs
102
97
103
- | Name | Description |
104
- | ------| -------------|
105
- | (Outputs to be dynamically populated) | |
98
+ | Name | Description | Type |
99
+ | ------| -------------| ------|
100
+ | ` profile_arns ` | List of created Bedrock inference profile ARNs | ` list(string) ` |
101
+ | ` guardrail_arns ` | List of created Bedrock guardrail ARNs | ` list(string) ` |
102
+ | ` guardrail_versions ` | Versions of created Bedrock guardrails | ` list(string) ` |
103
+
104
+ <!-- - END_TF_DOCS --->
105
+
106
+ ### Guardrails Configuration
107
+ | Field | Description | Type |
108
+ | -------| -------------| ------|
109
+ | ` name ` | Name of the guardrail | ` string ` |
110
+ | ` description ` | Description of the guardrail | ` string ` |
111
+ | ` filter_strength ` | Strength of content filtering (e.g., LOW, MEDIUM, HIGH) | ` string ` |
112
+ | ` filters ` | Types of content to filter | ` list(string) ` |
113
+ | ` tags ` | Optional tags for the guardrail | ` map(string) ` |
114
+
115
+ ### Profiles Configuration
116
+ | Field | Description | Type |
117
+ | -------| -------------| ------|
118
+ | ` name ` | Name of the inference profile | ` string ` |
119
+ | ` description ` | Description of the profile | ` string ` |
120
+ | ` source_inference_model_name ` | ARN or name of the source model | ` string ` |
121
+ | ` tags ` | Optional tags for the profile | ` map(string) ` |
122
+
123
+ ## Best Practices
124
+ 1 . Use comprehensive guardrails to ensure content safety
125
+ 2 . Configure multiple inference profiles for flexibility
126
+ 3 . Set appropriate budget alerts
127
+ 4 . Use tags for better resource management and tracking
128
+ 5 . Regularly review and update model configurations
106
129
107
130
## Contributing
108
131
0 commit comments