Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS rekognition and s3 bucket region

I am getting the following error when trying to access my s3 bucket with aws rekognition:

message: 'Unable to get object metadata from S3. Check object key, region and/or access permissions.',

My hunch is it has something to do with the region.

Here is the code:

const config = require('./config.json');
const AWS = require('aws-sdk');
AWS.config.update({region:config.awsRegion});
const rekognition = new AWS.Rekognition();


var params = {
   "CollectionId": config.awsFaceCollection
}

rekognition.createCollection(params, function(err, data) {
  if (err) {
    console.log(err, err.stack);
  }
  else  {
    console.log('Collection created');           // successful response
  }

});

And here is my config file:

{
  "awsRegion":"us-east-1",
  "s3Bucket":"daveyman123",
  "lexVoiceId":"justin",
  "awsFaceCollection":"raspifacecollection6"
}

I have given almost all the permissions to the user I can think of. Also the region for the s3 bucket appears to be in a place that can work with rekognition. What can I do?

like image 913
David Graff Avatar asked Sep 20 '25 11:09

David Graff


1 Answers

Was having the same issue and the solution was to to use the same region for the Rekognition API and S3 bucket, and if using a Role make sure that it has proper permissions to access both S3 and Rekognition.

like image 123
Miguel Mota Avatar answered Sep 22 '25 09:09

Miguel Mota