Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Resource]: aws_sagemaker_monitoring_schedule #29768

Closed
wrbooth opened this issue Mar 2, 2023 · 1 comment · Fixed by #30684
Closed

[New Resource]: aws_sagemaker_monitoring_schedule #29768

wrbooth opened this issue Mar 2, 2023 · 1 comment · Fixed by #30684
Labels
new-resource Introduces a new resource. service/sagemaker Issues and PRs that pertain to the sagemaker service.

Comments

@wrbooth
Copy link

wrbooth commented Mar 2, 2023

Description

We would like to be able to manage Sagemaker monitoring schedules through terraform. Some more detail on this capability can be found here:

https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-scheduling.html

Requested Resource(s) and/or Data Source(s)

  • aws_sagemaker_monitoring_schedule

Potential Terraform Configuration

resource "aws_sagemaker_monitoring_schedule" "my_schedule" {
  config = {
    monitoring_job_definition = {
      monitoring_app_specification = {
        image_uri = "ecr.awsamazon.com/my_image"
        container_arguments = ["--foo", "--bar"]
        container_entrypoint = ["/monitor/start", "--run"]
        post_analytics_processor_source_uri = "http://myanalyticsuri.com"
        record_preprocessor_source_uri = "http://mypreprocessoruri.com"
      }
      monitoring_inputs = [
        {
          endpoint_name = "my-inference-endpoint"
          local_path = "/mnt/endpoint"
          end_time_offset = "-PT7H"
          features_attribute = "feature"
          inference_attribute = "inference"
          probability_attribute = "probability"
          probability_threshold_attribute = 0.1
          s3_data_distribution_type = "ShardedByS3Key"
          s3_input_mode = "Pipe"
          start_time_offset = "-PT7H"
        },
        {
          data_captured_destination_s3_uri = "s3://captured-data-bucket"
          dataset_format = {
            json = {
              line = true
            }
          }
          local_path = "/mnt/endpoint"
          end_time_offset = "-PT7H"
          features_attribute = "feature"
          inference_attribute = "inference"
          probability_attribute = "probability"
          probability_threshold_attribute = 0.1
          s3_data_distribution_type = "ShardedByS3Key"
          s3_input_mode = "Pipe"
          start_time_offset = "-PT7H"
        }
      ]
      monitoring_output_config = {
        monitoring_outputs = [
          {
            s3_output = {
              local_path = "/monitor/output"
              s3_uri = "s3://monitor-output-bucket"
              s3_upload_mode = "Continuous"
            }
          }
        ]
        kms_key_id = "alias/key_id"
      }
      monitoring_resources = {
        cluster_config = {
          instance_count = 2
          instance_type = "ml.t3.large"
          volume_size_in_gb = 100
          volume_kms_key_id = "alias/my_key"
        }
      }
      role_arn = "arn::1234567:iam:my_role"
      baseline_config = {
        baselining_job_name = "baselining"
        constraints_resource = {
          s3_uri = "s3://my-constraint/constraint.csv"
        }
        statistics_resource = {
          s3_uri = "s3://my-statistics/statistics.csv"
        }
      }
      environment = {
        foo = "bar"
      }
      network_config = {
        enable_inter_container_traffic_encryption = true
        enable_network_isolation = true
        vpc_config = {
          SecurityGroupIds = ["sg-123456789"]
          Subnets = ["subnet-123456789"]
        }
      }
      monitoring_stopping_condition = {
        max_runtime_in_seconds = 3600
      }
    }
    monitoring_job_name = "my_job"
    type = "DataQuality"
    schedule_config = {
      schedule_expression = "cron(0 * ? * * *)"
    }   
  }
  name = "my_schedule"
  tags = ["tag1", "tag2"]
}

References

Sagemaker CreateMonitoringSchedule
Sagemaker DeleteMonitoringSchedule
Sagemaker DescribeMonitoringSchedule
Sagemaker ListMonitoringSchedules
Sagemaker StartMonitoringSchedule
Sagemaker StopMonitoringSchedule
Sagemaker UpdateMonitoringSchedule

Would you like to implement a fix?

Yes

@wrbooth wrbooth added the needs-triage Waiting for first response or review from a maintainer. label Mar 2, 2023
@wrbooth wrbooth changed the title [New Resource]: [New Resource]: aws_sagemaker_monitoring_schedule Mar 2, 2023
@DrFaust92 DrFaust92 added service/sagemaker Issues and PRs that pertain to the sagemaker service. new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 5, 2023
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/sagemaker Issues and PRs that pertain to the sagemaker service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants