如何通过 REST 公开 AWS Personalize 推荐 API
How to expose AWS Personlize recommendations via REST API
我想通过 REST API 向客户公开来自 AWS Personalize 的建议。在这一点上,我正在考虑 AWS API Gateway > AWS Lambda > AWS Personalise。
是否有本机方法或更好的方法来做到这一点?
使用 API 网关和 Lambda 函数是围绕个性化活动创建 REST API 的更常见方法之一。 API 网关使您能够添加缓存、节流、替代安全模式等。由于 Personalize GetRecommendations/GetPersonalizedRanking APIs only return itemIds and scores, you typically want to decorate the itemIds with the item metadata needed by clients to render recommendations (e.g., item price, name, description, image URL, etc). Otherwise your clients will likely have to lookup that information elsewhere. The Lambda function gives you the layer needed to lookup item metadata from your item catalog and return a response more suitable for rendering in an application. The Amazon Personalize Samples GitHub repo has an example 使用 SAM 部署 Lambda 函数以在 API 网关后面提供建议和摄取事件。
其他一些选项包括 AWS App Runner which supports deploying code from a GitHub repo or a Docker container image from ECR behind an auto-scaling API or a microservice in ECS/EKS behind an Application Load Balancer. An alternative to REST is a GraphQL endpoint using AWS AppSync 以及如上所述的 Lambda 函数。
最佳选择归结为最适合您现有架构或经验的方法。
我想通过 REST API 向客户公开来自 AWS Personalize 的建议。在这一点上,我正在考虑 AWS API Gateway > AWS Lambda > AWS Personalise。 是否有本机方法或更好的方法来做到这一点?
使用 API 网关和 Lambda 函数是围绕个性化活动创建 REST API 的更常见方法之一。 API 网关使您能够添加缓存、节流、替代安全模式等。由于 Personalize GetRecommendations/GetPersonalizedRanking APIs only return itemIds and scores, you typically want to decorate the itemIds with the item metadata needed by clients to render recommendations (e.g., item price, name, description, image URL, etc). Otherwise your clients will likely have to lookup that information elsewhere. The Lambda function gives you the layer needed to lookup item metadata from your item catalog and return a response more suitable for rendering in an application. The Amazon Personalize Samples GitHub repo has an example 使用 SAM 部署 Lambda 函数以在 API 网关后面提供建议和摄取事件。
其他一些选项包括 AWS App Runner which supports deploying code from a GitHub repo or a Docker container image from ECR behind an auto-scaling API or a microservice in ECS/EKS behind an Application Load Balancer. An alternative to REST is a GraphQL endpoint using AWS AppSync 以及如上所述的 Lambda 函数。
最佳选择归结为最适合您现有架构或经验的方法。