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

feat(aws-apigateway-sagemakerendpoint): New aws-apigateway-sagemakerendpoint pattern implementation #87

Merged
merged 5 commits into from
Oct 16, 2020

Conversation

dscpinheiro
Copy link
Contributor

Issue #, if available: #75

Description of changes: This PR introduces a new pattern, where inference from a deployed model in SageMaker can be done via API Gateway.

As mentioned on the issue, each ML use case is unique and the construct requires certain properties (such as resource path and request mapping template) to be provided. Also, for the documentation (README.md) and integration tests, I've used this blog post as a reference.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-rp7jMDIK1wBN
  • Commit ID: 235fa5e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@hnishar hnishar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first cut, few comments to look into

*
* @default - None.
*/
readonly endpointName: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it support both endpoint name and ARN ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path for the integration has to be endpoints/<sagemaker-endpoint-name>/invocations, so if ARN was used we'd have to parse it. Is there an example of this in Constructs right now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check aws-apigateway-iot pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I looked, but it's a subdomain there (e.g. ab123cdefghij4l-ats.iot.ap-south-1.amazonaws.com), which is different than the ARN. I could do something like this:

// Parse endpoint name
try {
    const components = Arn.parse(props.sageMakerEndpoint);
    
    // This line is required since resourceName is string | undefined
    if (!components.resourceName) {
        throw new Error('Provided ARN does not contain resource name');
    }

    this.sageMakerEndpointName = components.resourceName;
} catch {
    this.sageMakerEndpointName = props.sageMakerEndpoint;
}

Would that be enough? I'm not sure if the complexity added is worth it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth the complexity, let's make sure the comments clearly say it expects the endpoint Name and not the ARN of the endpoint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the interface comment and README file mention name, not ARN (Name of the deployed SageMaker inference endpoint). Is there anywhere I should change it?

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-rp7jMDIK1wBN
  • Commit ID: 7c79371
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-rp7jMDIK1wBN
  • Commit ID: bc65b1c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-solutions-constructs-team
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: codebuildgithubautobuildPro-rp7jMDIK1wBN
  • Commit ID: 34ee408
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@hnishar hnishar merged commit 81d3b8b into awslabs:master Oct 16, 2020
@hnishar
Copy link
Contributor

hnishar commented Oct 16, 2020

Thanks for the contribution, the pattern will be published in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants