Toegang tot Amazon Bedrock

Introductie tot Amazon Bedrock

Nikhil Rangarajan

Data Scientist

Maak kennis met je instructeur!

  • Machine learning engineer
  • Cloudtechnologie (AWS, Azure)
  • Data-, cloud- en computerengineering

De profielfoto van de instructeur

Introductie tot Amazon Bedrock

Wat is Amazon Bedrock?

  • Amazon-service

De AWS- en Amazon Bedrock-logo's

Introductie tot Amazon Bedrock

Wat is Amazon Bedrock?

  • Amazon-service
  • AI-modellen aangeroepen via API
    • API: een boodschapper tussen softwaresystemen
  • Bedrock biedt toegang tot modellen van o.a. Anthropic, Meta, enz.
  • Geen setup of training nodig – betalen per gebruik

De AWS- en Amazon Bedrock-logo's en een diagram van een API.

Introductie tot Amazon Bedrock

Foundation models in Generatieve AI

  • Voorgetrainde modellen
  • Basis voor meerdere AI-taken
  • Genereren tekst, code, afbeeldingen op basis van prompts
    • Tekst/Chat: Claude, Jurassic
    • Afbeelding: Stable Diffusion
    • Embedding: Titan

 

Een diagram met een Foundation Model in het midden en vier pijlen naar: Text/Chat, Embeddings, Code en Images.

Introductie tot Amazon Bedrock

Toegang tot Amazon Bedrock begrijpen

Let op: In deze course zijn Access Key en Secret Key vooraf geladen.

 

  • Bedrock-toegang inschakelen in AWS:
    • Maak een IAM-gebruiker in de AWS Console
    • Voeg Amazon Bedrock Full Access toe
    • Haal je toegangssleutels op:
      • Access Key
      • Secret Key
      • Regio (bijv. 'us-east-1')

Een flowchart met drie stappen om Amazon Bedrock-toegang in AWS te activeren. Stap 1: IAM-gebruiker maken, Stap 2: Bedrock-toegang toevoegen, Stap 3: Inloggegevens ophalen.

Introductie tot Amazon Bedrock

Bedrock runtime-toegang instellen

  • Configureer AWS-credentials in je omgeving
# Not secure for production, only for teaching purposes
AWS_REGION = 'us-east-1'

AWS_ACCESS_KEY = 'your-access-key'
AWS_SECRET_KEY = 'your-secret-key'
  • Initialiseer Bedrock-client
  • Gebruik 'bedrock-runtime' voor modelinference
    import boto3 
    bedrock = boto3.client('bedrock-runtime', # use -runtime
      region_name=AWS_REGION,
      aws_access_key_id=AWS_ACCESS_KEY,
      aws_secret_access_key=AWS_SECRET_KEY)
    
Introductie tot Amazon Bedrock

Bedrock-toegang instellen

  • Controleer client-initialisatie
  • Gebruik 'bedrock' voor operationele requests

 

# Verify Bedrock client configuration
import boto3
bedrock_client = boto3.client('bedrock', region_name='us-east-1')

models = bedrock_client.list_foundation_models() print(f"Connected successfully! Found {len(models['modelSummaries'])} available models.")
Connected successfully!  Found 13 available models.
Introductie tot Amazon Bedrock

Informatie over foundation models

  • Gebruik get_foundation_model() om modeldetails op te halen

 

  • Vereist een ModelID, unieke ID
    • Voorbeeld: amazon.nova-2-lite-v1:0, anthropic.claude-sonnet-4-5-20250929-v1:0

 

response = bedrock_client.get_foundation_model
    (modelIdentifier='anthropic.claude-sonnet-4-5-20250929-v1:0')
print(response['modelDetails'])
Introductie tot Amazon Bedrock

Informatie over foundation models

{'modelArn': 'arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-5...',
 'modelId': 'anthropic.claude-sonnet-4-5-20250929-v1:0',
 'modelName': 'Claude Sonnet 4.5',
 'providerName': 'Anthropic',
 'inputModalities': ['TEXT', 'IMAGE'],
 'outputModalities': ['TEXT'],
 'responseStreamingSupported': True,
 'customizationsSupported': [],
 'inferenceTypesSupported': ['INFERENCE_PROFILE'],
 'modelLifecycle': {'status': 'ACTIVE', 'startOfLifeTime': ...}
Introductie tot Amazon Bedrock

Laten we oefenen!

Introductie tot Amazon Bedrock

Preparing Video For Download...