My colleague successfully perform the following code showing the table without setting the credentials in local environment, but when i conduct it it shows such error on my local machine. Please help.
Please find my codes below:
Controller:
AWS.config.update({
region: 'localhost',
endpoint: new AWS.Endpoint('http://localhost:8008'),
})
var params = {
TableName: 'history',
KeySchema: [{
AttributeName: 'b_id',
KeyType: 'HASH'
},{
AttributeName: 'e_id',
KeyType: 'RANGE'
}],
AttributeDefinitions: [{
AttributeName: 'b_id',
AttributeType: 'S',
},{
AttributeName: 'e_id',
AttributeType: 'N',
}],
ProvisionedThroughput: { // required provisioned throughput for the table
ReadCapacityUnits: 1,
WriteCapacityUnits: 1,
},
}
response.implicitEnd = false
AWS.query('history',params, function(err, data){
if(err) console.log(err)
else response.json(data)
})
Error Message:
{ Error: connect EHOSTUNREACH 169.254.169.254:80 - Local () at Object._errnoException (util.js:1022:11) at _exceptionWithHostPort (util.js:1044:20) at internalConnect (net.js:971:16) at net.js:1065:9 at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickDomainCallback (internal/process/next_tick.js:218:9) message: 'Missing credentials in config', code: 'CredentialsError', errno: 'EHOSTUNREACH', syscall: 'connect', address: '169.254.169.254', port: 80, time: 2018-04-30T04:34:53.218Z, originalError: { message: 'Could not load credentials from any providers', code: 'CredentialsError', errno: 'EHOSTUNREACH', syscall: 'connect', address: '169.254.169.254', port: 80, time: 2018-04-30T04:34:53.218Z, originalError: { code: 'EHOSTUNREACH', errno: 'EHOSTUNREACH', syscall: 'connect', address: '169.254.169.254', port: 80, message: 'connect EHOSTUNREACH 169.254.169.254:80 - Local ()' } } }
> which python
/usr/bin/python
> pip install --upgrade pip
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages (10.0.1)
metplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
> pip --version
pip 10.0.1 from /Library/Python/2.7/site-packages/pip (python 2.7)
> echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
> python --version
Python 2.7.10
Error: connect EHOSTUNREACH 169.254.169.254:80
is a failure to connect to the EC2 instance metadata service, which is expected since you are not running this code inside EC2. The most likely explanation is that your colleague does indeed have credentials configured in their local environment. – Michael - sqlbottouch
it it still doesnt work (sorry for my lack of bash knowledge) – warmjaijai.profile
. If you have sudo access, you cansudo pip install awscli
and you don't have to redefine the path. – Michael - sqlbotawc: command not found
– warmjaijai.profile
either – warmjaijai