AI Model Wiki

    Skip to main content
    22 min
    Lesson 1 of 4

    Amazon Bedrock Architecture

    From the course AWS Bedrock Advanced

    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

    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

    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

    Key Takeaways

    • •Bedrock provides unified API access to Claude, Llama, Nova, and other leading models
    • •Serverless architecture eliminates infrastructure management
    • •Enterprise security features include VPC isolation, KMS, and comprehensive audit logging
    • •Data processed on Bedrock is never used to train foundation models
    0 of 4 lessons marked complete

    Progress is kept in this browser only.