Skip to content

giuseppe-trisciuoglio/developer-kit / plugins/developer-kit-aws/skills/aws-cloudformation/aws-cloudformation-bedrock

aws-cloudformation-bedrock

Verified

Provides AWS CloudFormation patterns for Amazon Bedrock resources including agents, knowledge bases, data sources, guardrails, prompts, flows, and inference profiles. Use when creating Bedrock agents with action groups, implementing RAG with knowledge bases, configuring vector stores, setting up content moderation guardrails, managing prompts, orchestrating workflows with flows, and configuring inference profiles for model optimization.

FileKindSize
SKILL.mdskill md12.7 KB
references/constraints.mdmarkdown7.7 KB
references/examples.mdmarkdown41.6 KB
references/reference.mdmarkdown32.0 KB

references/constraints.md

View on GitHub
# AWS Bedrock Constraints and Limitations

## Resource Limits

### Agent and Knowledge Base Limits

```yaml
# Agent limits vary by region
# Knowledge bases have document and storage limits
# Guardrails have account-level limits

Parameters:
  MaxKnowledgeBaseDocuments:
    Type: Number
    Default: 10000
    Description: Expected number of documents in knowledge base

  MaxGuardrails:
    Type: Number
    Default: 10
    Description: Expected number of guardrails
```

## Model Availability Constraints

### Regional Model Availability

```yaml
# Not all foundation models available in all regions
# Check model availability before deployment

Parameters:
  ModelRegion:
    Type: String
    Default: us-east-1
    AllowedValues:
      - us-east-1
      - us-west-2
      - eu-west-1
      - eu-central-1
      - ap-southeast-1
      - ap-northeast-1
    Description: Region for model deployment

Resources:
  BedrockAgent:
    Type: AWS::Bedrock::Agent
    Properties:
      AgentName: !Sub "${AWS::StackName}-agent"
      AgentResourceRoleArn: !Ref AgentRole
      FoundationModel: !Sub "${ModelRegion}.amazon.${FoundationModel}"
```

### Model-Specific Constraints

```yaml
# Different models have different token limits
# Rate limiting varies by model

Parameters:
  FoundationModel:
    Type: String
    Default: anthropic.claude-3-sonnet-20240229-v1:0
    AllowedValues:
      - anthropic.claude-3-sonnet-20240229-v1:0
      - anthropic.claude-3-haiku-20240307-v1:0
      - anthropic.claude-3-opus-20240229-v1:0
      - amazon.titan-text-express-v1
      - ai21.jamba-1-2-ultra-v1:0
    Description: Foundation model identifier

  MaxTokens:
    Type: Number
    Default: 4096
    MaxValue: 100000
    Description: Maximum tokens per request
```

## Operational Constraints

### Agent Initialization

```yaml
# AutoPrepare agents may take time to initialize
# Plan for cold start delays

Resources:
  BedrockAgent:
    Type: AWS::Bedrock::Agent
    Properties:
      AgentName: !Sub "${AWS::StackName}-agent"
      AutoPrepare: true
      # Agent initialization may take several minutes
```

### Knowledge Base Sync

```yaml
# Data source synchronization is not instantaneous
# Plan for sync delays when using S3 or web crawl

Resources:
  DataSource:
    Type: AWS::Bedrock::DataSource
    Properties:
      KnowledgeBaseId: !Ref KnowledgeBase
      Name: s3-data-source
      Type: S3
      DataSourceConfiguration:
        S3Configuration:
          BucketArn: !GetAtt DataBucket.Arn
          InclusionPrefixes:
            - documents/
      # S3 sync is near-instant but web crawl takes time
```

## Security Constraints

### PII Protection

```yaml
# Sensitive information may not be detected in all formats
# Implement additional validation as needed

Resources:
  Guardrail:
    Type: AWS::Bedrock::Guardrail
    Properties:
      Name: pii-protection
      SensitiveInformationPolicyConfig:
        PIIEntitiesConfig:
          - Name: EmailAddress
            Type: EMAIL
          - Name: SSN
            Type: CUSTOM_ID
            # Additional PII types as needed
```

### Web Crawl Security

```yaml
# Web-crawled content is untrusted and may contain prompt injection payloads
# Always restrict to trusted domains and validate content

Resources:
  WebCrawlDataSource:
    Type: AWS::Bedrock::DataSource
    Properties:
      KnowledgeBaseId: !Ref KnowledgeBase
      Name: web-crawl-source
      Type: WEB
      DataSourceConfiguration:
        WebConfiguration:
          SeedUrls:
            - !Ref TrustedUrl
          # CRITICAL: Restrict to trusted internal domains only
          InclusionFilters:
            - FilterType: DOMAIN
              Pattern: !Sub ".*\\.${TrustedDomain}"
          ExclusionFilters:
            # Exclude potentially malicious content
            - FilterType: CONTENT_TYPE
              Pattern: "application/x-executable"
            - FilterType: PATTERN
              Pattern: "<script>"
      # NEVER crawl public websites without validation
```

### Nested Template Security

```yaml
# Always use parameterized TemplateURL values
# NEVER hardcode S3 URLs for nested stack templates

Parameters:
  TemplateBucket:
    Type: AWS::S3::Bucket::Name
    Description: Trusted S3 bucket for templates

Resources:
  NestedStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub "https://${TemplateBucket}.s3.${AWS::Region}.amazonaws.com/bedrock-nested.yaml"
      # CORRECT: Parameterized with !Sub
      # WRONG: TemplateURL: "https://my-bucket.s3.us-east-1.amazonaws.com/template.yaml"
```

### Input Validation

```yaml
# Validate content ingested through knowledge bases before indexing
# Implement validation filters for S3 and web crawl sources

Resources:
  S3DataSource:
    Type: AWS::Bedrock::DataSource
    Properties:
      KnowledgeBaseId: !Ref KnowledgeBase
      Name: validated-s3-source
      Type: S3
      DataSourceConfiguration:
        S3Configuration:
          BucketArn: !GetAtt DataBucket.Arn
          # Validate files before syncing
          InclusionPrefixes:
            - validated/
      # Implement Lambda function to validate content before sync
```

## Cost Considerations

### Token Usage Optimization

```yaml
# RAG implementations increase token consumption
# Use chunking and filtering strategies

Parameters:
  ChunkSize:
    Type: Number
    Default: 300
    AllowedValues:
      - 100
      - 300
      - 500
      - 1000
    Description: Chunk size for documents (affects token usage)

  MaxChunks:
    Type: Number
    Default: 20
    Description: Maximum chunks to retrieve
```

### Knowledge Base Costs

```yaml
# Storing and syncing large datasets increases costs
# Use appropriate storage classes

Resources:
  KnowledgeBase:
    Type: AWS::Bedrock::KnowledgeBase
    Properties:
      Name: !Sub "${AWS::StackName}-kb"
      RoleArn: !Ref KnowledgeBaseRole
      KnowledgeBaseConfiguration:
        Type: VECTOR
        VectorKnowledgeBaseConfiguration:
          EmbeddingModelArn: !Ref EmbeddingModel
          # Storage and sync costs apply
```

## Best Practices to Avoid Constraints

### Use Appropriate Models

```yaml
# Select models based on use case requirements
# Use smaller models for simple tasks

Parameters:
  ModelType:
    Type: String
    Default: claude-3-haiku
    AllowedValues:
      - claude-3-haiku      # Fast, cost-effective
      - claude-3-sonnet     # Balanced performance
      - claude-3-opus       # Most capable
    Description: Model selection based on task complexity
```

### Optimize Knowledge Base Queries

```yaml
# Use filtering to reduce token usage
# Implement relevance scoring

Resources:
  BedrockAgent:
    Type: AWS::Bedrock::Agent
    Properties:
      AgentName: optimized-agent
      Instruction: |
        Use knowledge base retrieval filtering to reduce costs.
        Only retrieve relevant documents for the query.
      KnowledgeBaseIds:
        - !Ref KnowledgeBase
      KnowledgeBaseConfiguration:
        KnowledgeBaseState: ENABLED
        RetrievalConfiguration:
          VectorSearchConfiguration:
            NumberOfResults: 5  # Limit retrieved documents
```

### Monitor Token Consumption

```yaml
# Set up budget alerts for Bedrock usage

Resources:
  BedrockBudget:
    Type: AWS::Budgets::Budget
    Properties:
      Budget:
        BudgetLimit:
          Amount: 100
          Unit: USD
        TimeUnit: MONTHLY
        BudgetType: COST
        CostFilters:
          Service:
            - Amazon Bedrock
```

## Quota Management

### Request Quota Increases

```yaml
# Service quotas can be increased via AWS Support
# Document requirements in stack outputs

Outputs:
  QuotaIncreaseRequest:
    Description: Link to request quota increase
    Value: !Sub "https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&serviceCode=amazon-bedrock"
```
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall