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

[Enhancement]: SageMaker Endpoints: add InputAndOutput capture options mode #37330

Closed
jtornblad opened this issue May 7, 2024 · 7 comments · Fixed by #37726
Closed

[Enhancement]: SageMaker Endpoints: add InputAndOutput capture options mode #37330

jtornblad opened this issue May 7, 2024 · 7 comments · Fixed by #37726
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/sagemaker Issues and PRs that pertain to the sagemaker service.
Milestone

Comments

@jtornblad
Copy link

Description

For SageMaker endpoints, data capture can be configured to capture the Input, Output OR both as "InputAndOutput". Currently the provider rejects this option setting for "InputAndOutput" with the error message:

Error: expected data_capture_config.0.capture_options.0.capture_mode to be one of [Input Output], got InputAndOutput

For capture_mode, the aws_sagemaker_endpoint_configuration should accept "Input", "Output" OR "InputAndOutput" as valid values.

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

aws_sagemaker_endpoint_configuration

Potential Terraform Configuration

resource "aws_sagemaker_endpoint_configuration" "my_endpoint_configuration" {
  name        = "my_endpoint_configuration"

  production_variants {
    variant_name           = "variant-1"
    model_name             = aws_sagemaker_model.my_model.name
    initial_instance_count = 1
    instance_type          = "ml.t2.medium"
  }
  data_capture_config {
    initial_sampling_percentage = 100
    destination_s3_uri          = "s3://my_bucket/my_path"
    capture_options {
      capture_mode = "InputAndOutput"
    }
    enable_capture = true
  }
  depends_on = [
    aws_sagemaker_model.my_model
  ]
}

References

See SageMaker allowed values for capture mode in endpoint configuration at https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CaptureOption.html#sagemaker-Type-CaptureOption-CaptureMode

Would you like to implement a fix?

Yes

@jtornblad jtornblad added the enhancement Requests to existing resources that expand the functionality or scope. label May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/sagemaker Issues and PRs that pertain to the sagemaker service. label May 7, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 7, 2024
@justinretzolk justinretzolk changed the title [Enhancement]: [Enhancement]: SageMaker Endpoints: add InputAndOutput capture options mode May 8, 2024
@justinretzolk justinretzolk added good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. and removed needs-triage Waiting for first response or review from a maintainer. labels May 8, 2024
@aayushsss1
Copy link

@justinretzolk @jtornblad

It looks like this is already supported here -

ValidateFunc: validation.StringInSlice(sagemaker.CaptureMode_Values(), false),

and this function is being called from the aws-sdk-go with the InputAndOutput option already defined

const (
	// CaptureModeInput is a CaptureMode enum value
	CaptureModeInput = "Input"

	// CaptureModeOutput is a CaptureMode enum value
	CaptureModeOutput = "Output"

	// CaptureModeInputAndOutput is a CaptureMode enum value
	CaptureModeInputAndOutput = "InputAndOutput"
)

// CaptureMode_Values returns all elements of the CaptureMode enum
func CaptureMode_Values() []string {
	return []string{
		CaptureModeInput,
		CaptureModeOutput,
		CaptureModeInputAndOutput,
	}
}

@CrazyFunker
Copy link

@aayushsss1 I have tried InputAndOutput today with the latest TF AWS provider (v5.50.0), unfortunately this only applies:
Data capture options: Prediction request only, without Prediction response.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.57.0 milestone Jun 28, 2024
Copy link

github-actions bot commented Jul 5, 2024

This functionality has been released in v5.57.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@tyegagne
Copy link

We've found that the 'InputAndOutput' argument while documented as supported on the AWS SDK side, it appears to throw Validation Errors in CloudTrail when supplied. The workaround we're applying with success in Terraform is documented below:

resource "aws_sagemaker_endpoint_configuration" "xx_config" {
  name        = "xx-endpoint-config-${var.stack-name}"
  kms_key_arn = var.kms_key_arn

  production_variants {
    variant_name           = "xx-${var.stack-name}"
    model_name             = aws_sagemaker_model.xx_model.name
    initial_instance_count = 1
    instance_type          = "ml.m5.large"
  }
  data_capture_config {
    initial_sampling_percentage = 100
    destination_s3_uri          = "s3://xx/xx}/inferences/"
    capture_options {
      capture_mode = "Input"
    }
    capture_options {
      capture_mode = "Output"
    }
    enable_capture = true
  }
  depends_on = [
    aws_sagemaker_model.xx_model
  ]
}

This approach of supplying 2x capture_options {} one with Input and the other with Output allows for a workaround of capture_options not accepting an array of options and 'InputAndOutput' not functioning as an argument supplied to AWS. A support ticket was opened with AWS, and the support engineer said they are opening up a documentation update with the service team.

When this capture config is supplied the config builds and endpoint is able to inherit the config with Request and Response capture.

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 Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/sagemaker Issues and PRs that pertain to the sagemaker service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants