This template creates a custom model in AWS Bedrock by starting a customization job using a base model and specified hyperparameters.

Terraform Template

data "aws_bedrock_foundation_model" "example" {
  model_id = "amazon.titan-text-express-v1"
}

resource "aws_bedrock_custom_model" "example" {
  base_model_identifier = data.aws_bedrock_foundation_model.example.model_arn
  custom_model_name = "example-model"

  hyperparameters = {
    batchSize = "1"
    epochCount = "1"
    learningRate = "0.005"
    learningRateWarmupSteps = "0"
  }
  job_name = "example-job-1"

  output_data_config {
    s3_uri = "s3://${aws_s3_bucket.output.id}/data/"
  }
  role_arn = "aws_iam_role.example.arn"

  training_data_config {
    s3_uri = "s3://${aws_s3_bucket.training.id}/data/train.jsonl"
  }
}