Search code examples
azureamazon-s3azure-cognitive-services

Can Azure computer vision API access image file in AWS S3?


AWS is currently the approved cloud vendor in my organization. For a new use case related to OCR, I'm exploring the Computer Vision service in Azure (read that this service is better than the corresponding AWS Textract service). Our approach is to maintain the input image files in S3, use AWS Lambda function to invoke the Azure Computer Vision service (either through REST API or Python SDK). AWS will be the primary cloud vendor for most aspects (specifically storage) and we plan to access Azure services through API for additional needs.

My question is will Azure API/SDK accept the image file in S3 as input (of course we will do whatever is needed to make the file in S3 securely accessible to Azure API)? When I read the Azure documentation, it says the image should be accessible as an URL and there is no mention that the image needs to exist in Azure storage. Should the image URL be publicly accessible (believe this should not be the case)?


Solution

  • Unfortunately the Cognitive API does not support authentication when passing a URL.

    An approach would be to write an Azure Function that:

    1. Authenticates correctly to S3 and read the image file using the Amazon S3 API
    2. Covert the file in to a ByteArray
    3. Send the byte array to the Computer Vision API
    4. Receive the JSON result from the Computer Vision API and process accordingly

    You could have the Azure function perform the business logic you need and process and store the results, or you could build the function as a web service proxy that takes a S3 location in as a parameter and returns the Computer Vision result.

    You could also build the functionality out in AWS using Lambda.