Amazon Bedrock provides fully managed foundation model access with enterprise-grade security, compliance, and scalability.
## Core Concepts
### Foundation Model Access Available models on Bedrock: - Amazon Nova: Amazon's latest multimodal models - Anthropic Claude: Claude 3.5 Sonnet, Opus, Haiku - Meta Llama: Llama 3.1, 3.2 series - Cohere: Command R, Embed models - Mistral AI: Mistral and Mixtral models - Stability AI: Stable Diffusion image generation - AI21 Labs: Jamba and Jurassic models
### Key Features - Serverless: No infrastructure to manage - Single API: Unified API across all models - Security: VPC isolation, KMS encryption - Compliance: SOC 2, HIPAA, PCI DSS, GDPR - Private: Data not used for model training
## Quick Start
### Basic API Usage ```python import boto3 import json
bedrock = boto3.client( service_name='bedrock-runtime', region_name='us-east-1' )
# Claude 3.5 Sonnet response = bedrock.invoke_model( modelId='anthropic.claude-3-5-sonnet-20241022-v2:0', body=json.dumps({ "anthropic_version": "bedrock-2023-05-31", "max_tokens": 1024, "messages": [{ "role": "user", "content": "Explain transformer architecture" }] }) )
result = json.loads(response['body'].read()) print(result['content'][0]['text']) ```
### Streaming Responses ```python response = bedrock.invoke_model_with_response_stream( modelId='anthropic.claude-3-5-sonnet-20241022-v2:0', body=json.dumps({ "anthropic_version": "bedrock-2023-05-31", "max_tokens": 1024, "messages": [{"role": "user", "content": prompt}] }) )
# Stream output for event in response['body']: chunk = json.loads(event['chunk']['bytes']) if chunk.get('type') == 'content_block_delta': print(chunk['delta']['text'], end='', flush=True) ```
## Enterprise Security - IAM Policies: Granular access control per model - VPC Endpoints: Private connectivity within AWS - KMS Integration: Customer-managed encryption keys - CloudTrail: Comprehensive API audit logging - GuardDuty: Threat detection for model API calls