Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-small-3.1-24b-instruct-2503· Mistral AIHugging Face LMArena Human Preference 140K

Generate cloudformation to create bedrock i can play with. Include everything what is…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514-thinking-32k’s answer.
  1. User

    Generate cloudformation to create bedrock i can play with. Include everything what is necessary

  2. Mistral Assistant

    Creating a CloudFormation template to set up Amazon Bedrock involves several steps, including setting up the necessary IAM roles, policies, and the Bedrock service itself. Below is a basic example of a CloudFormation template that sets up the necessary components to get started with Amazon Bedrock.

    Please note that as of my knowledge cutoff in October 2023, Amazon Bedrock is a relatively new service, and the specifics of its setup might evolve. Always refer to the latest AWS documentation for the most accurate and up-to-date information.

    AWSTemplateFormatVersion: '2010-09-09'
    Description: CloudFormation template to set up Amazon Bedrock
    
    Resources:
      BedrockExecutionRole:
        Type: 'AWS::IAM::Role'
        Properties:
          AssumeRolePolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: 'Allow'
                Principal:
                  Service: 'bedrock.amazonaws.com'
                Action: 'sts:AssumeRole'
          Policies:
            - PolicyName: 'BedrockExecutionPolicy'
              PolicyDocument:
                Version: '2012-10-17'
                Statement:
                  - Effect: 'Allow'
                    Action:
                      - 'bedrock:InvokeModel'
                      - 'bedrock:DescribeModel'
                      - 'bedrock:ListModels'
                    Resource: '*'
    
      BedrockModel:
        Type: 'AWS::Bedrock::Model'
        Properties:
          ModelName: 'MyBedrockModel'
          ModelType: 'MyModelType'  # Replace with the actual model type you want to use
          ModelArn: 'arn:aws:bedrock:region:account-id:model/model-id'  # Replace with the actual model ARN
    
      BedrockEndpoint:
        Type: 'AWS::Bedrock::Endpoint'
        Properties:
          EndpointName: 'MyBedrockEndpoint'
          ModelName: !Ref BedrockModel
          EndpointConfigName: 'MyEndpointConfig'
    
      BedrockEndpointConfig:
        Type: 'AWS::Bedrock::EndpointConfig'
        Properties:
          EndpointConfigName: 'MyEndpointConfig'
          ModelName: !Ref BedrockModel
          InstanceType: 'ml.m5.xlarge'  # Replace with the appropriate instance type
    
    Outputs:
      BedrockEndpointArn:
        Description: 'The ARN of the Bedrock Endpoint'
        Value: !GetAtt BedrockEndpoint.EndpointArn
        Export:
          Name: 'BedrockEndpointArn'
    

    Explanation:

    1. IAM Role (BedrockExecutionRole):

      • This role allows the Bedrock service to assume the role and perform necessary actions.
      • The policy attached to this role grants permissions to invoke, describe, and list models.
    2. Bedrock Model (BedrockModel):

      • This resource represents the model you want to use with Bedrock.
      • Replace ModelType and ModelArn with the actual model type and ARN you intend to use.
    3. Bedrock Endpoint (BedrockEndpoint):

      • This resource represents the endpoint where the model will be deployed.
      • It references the model and endpoint configuration.
    4. Bedrock Endpoint Configuration (BedrockEndpointConfig):

      • This resource defines the configuration for the endpoint, including the instance type.

    Important Notes:

    • Model Type and ARN: Replace ModelType and ModelArn with the actual values specific to the model you want to use.
    • Instance Type: Choose an appropriate instance type based on your requirements and the model's needs.
    • Region and Account ID: Ensure the ModelArn includes the correct region and account ID.

    Deployment:

    1. Save the above YAML content to a file, e.g., bedrock-setup.yaml.
    2. Use the AWS Management Console, AWS CLI, or AWS SDKs to deploy the stack.
    aws cloudformation create-stack --stack-name MyBedrockStack --template-body file://bedrock-setup.yaml
    

    This template provides a basic setup. Depending on your specific use case, you might need to add more resources, configurations, or adjust the existing ones. Always refer to the latest AWS documentation for the most accurate and detailed information.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.