AWS CDK:Api网关,sagemaker集成,不支持SageMakerRuntime类型的AWS服务错误

时间:2020-04-30 03:38:51

标签: amazon-web-services amazon-cloudformation aws-api-gateway amazon-sagemaker aws-cdk

当我将服务设置为SageMakerRuntimeSageMaker时,它引发了错误AWS Service of type SagemakerRuntime not supported (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException;,我找不到有关受支持的服务的文档。但是,从控制台设置api网关时,我看到选项SageMaker Runtime,其余配置正常。

const integration = new AwsIntegration({
      service: "SageMakerRuntime",
      path: "endpoints/{endpointName}/invocations",
      integrationHttpMethod: "POST",
      options: {
        credentialsRole: Role.fromRoleArn(
          this,
          "Execution role",
          "<arn>"
        )
      }
    });
const postMethod = api.root
      .addResource(this.node.tryGetContext("serviceVersion"))
      .addResource("endpoints")
      .addResource("{endpointName}")
      .addResource("inferences")
      .addMethod("POST", integration);

1 个答案:

答案 0 :(得分:1)

CDK中的SageMaker Runtime服务名称为runtime.sagemaker。将该参数传递给service参数,您应该会很好。

对于CDK,服务名称使用的格式与aws list-services显示的格式不同。我在ServiceName下找到了这种格式: https://docs.aws.amazon.com/sdk-for-go/api/service/sagemakerruntime/