CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-pulumi--aws

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources with infrastructure-as-code.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

bedrock.mddocs/services/

Amazon Bedrock

Amazon Bedrock is a fully managed service for building generative AI applications with foundation models.

Package

import * as aws from "@pulumi/aws";

Overview

Amazon Bedrock provides access to foundation models from leading AI companies through a single API.

Available Models

  • Anthropic Claude: Conversational AI and text generation
  • AI21 Labs Jurassic: Text generation and summarization
  • Stability AI: Image generation
  • Amazon Titan: Text and embeddings
  • Cohere: Text generation and embeddings
  • Meta Llama: Open-source foundation models

Common Use Cases

Text Generation

// Example IAM policy for Bedrock access
const bedrockPolicy = new aws.iam.Policy("bedrock-access", {
    policy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Effect: "Allow",
            Action: [
                "bedrock:InvokeModel",
                "bedrock:InvokeModelWithResponseStream",
            ],
            Resource: "arn:aws:bedrock:*::foundation-model/*",
        }],
    }),
});

Model Customization

Fine-tune foundation models with your own data.

const customizationRole = new aws.iam.Role("bedrock-customization", {
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Effect: "Allow",
            Principal: {
                Service: "bedrock.amazonaws.com",
            },
        }],
    }),
});

new aws.iam.RolePolicy("bedrock-s3-access", {
    role: customizationRole.id,
    policy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Effect: "Allow",
            Action: ["s3:GetObject", "s3:ListBucket"],
            Resource: [bucket.arn, pulumi.interpolate`${bucket.arn}/*`],
        }],
    }),
});

Knowledge Bases

Create RAG (Retrieval-Augmented Generation) applications.

const knowledgeBaseRole = new aws.iam.Role("kb-role", {
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Effect: "Allow",
            Principal: {
                Service: "bedrock.amazonaws.com",
            },
        }],
    }),
});

Agents

Build AI agents that can take actions.

const agentRole = new aws.iam.Role("agent-role", {
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Effect: "Allow",
            Principal: {
                Service: "bedrock.amazonaws.com",
            },
        }],
    }),
});

Use Cases

  • Chatbots: Conversational AI applications
  • Content Generation: Create marketing copy, articles
  • Summarization: Summarize documents and data
  • Code Generation: Generate and explain code
  • Image Generation: Create images from text descriptions
  • RAG Applications: Question answering over your data

Best Practices

  1. Use IAM Policies: Control access to models
  2. Monitor Usage: Track API calls and costs
  3. Implement Caching: Cache responses when appropriate
  4. Handle Rate Limits: Implement retry logic
  5. Sanitize Inputs: Validate and clean user inputs

Related Services

  • Lambda - Serverless inference
  • API Gateway - Expose Bedrock APIs
  • S3 - Store training data
  • OpenSearch - Vector search for RAG

Install with Tessl CLI

npx tessl i tessl/npm-pulumi--aws

docs

index.md

quickstart.md

README.md

tile.json