Read output json files | Batch Recommendations Inference Job

0

After created a Batch inference job to get Batch Recommendation I cannot figure it out how to delivery recommendation to my application (React Native) from file stored on S3 Bucket.

1개 답변
2

It sounds like you're trying to query batch inference results in a real-time web application... Which is a little surprising as wouldn't a Personalize "Campaign" for real-time inference seem like a better fit here? In that case you'd be able to call the GetRecommendations API or similar for a user ID on-demand.

But assuming you have a use case that does require batch Personalize inference and real-time querying:

In general (as shown in the examples here in the developer guide), Personalize batch inference results are in JSON-Lines format: Each file being a newline-separated list of JSON objects.

It's possible to use S3 Select to query a subset of records directly from an object in S3 (examples here). You could also consider Amazon Athena (e.g. blog post here) for querying across multiple sharded files.

However, depending on your usage profile and latency requirements, you may want to index the batch job results into some kind of database for retrieval instead of querying the batch files each time. For example, DynamoDB could give very fast performance for indexing and querying recommendations by user ID. You could consider AWS Glue to implement this ETL from S3 to DynamoDB/database in a serverless but scalable way.

Finally, regardless of whether you're using a direct S3 API or a database (or a Personalize real-time campaign), your application client will need some IAM-linked authentication to demonstrate it's allowed to access your data. This might be with Amazon Cognito or some other approach. the personalization-apis sample shows several options proxying through API Gateway.

AWS
전문가
Alex_T
답변함 2년 전
  • Hi, @Alex_T. Thank you for your answer. I'll try each possibilities.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인