Reputation: 7919
I try to use aws
with ClaudiaJS so first I downlolad hello world example from claudiajs github and then on my aws create a user with these AWSLambdaFullAccess
,IAMFullAccess
and AmazonAPIGatewayAdministrator
and then configure .aws/credentials
file with awscli
and change profile name from default to claudia and now my credentials is something like this :
[claudia]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxx
after that according to the tutorial I run npm i
and then npm start
.the scripts is like this :
"scripts": {
"start": "claudia create --name hello-world --region us-east-1 --handler main.handler",
"test": "claudia test-lambda",
"deploy": "claudia update"
},
but after npm start
I get these errors :
npm start
> [email protected] start /home/interact/Try/hello-world
> claudia create --name hello-world --region us-east-1 --handler
main.handler
initialising IAM role iam.createRole RoleName=hello-world-executor
{ Error: connect EHOSTUNREACH 169.254.169.254:80
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
message: 'Missing credentials in config',
code: 'CredentialsError',
errno: 'EHOSTUNREACH',
syscall: 'connect',
address: '169.254.169.254',
port: 80,
time: 2018-06-13T07:50:47.292Z,
originalError:
{ message: 'Could not load credentials from any providers',
code: 'CredentialsError',
errno: 'EHOSTUNREACH',
syscall: 'connect',
address: '169.254.169.254',
port: 80,
time: 2018-06-13T07:50:47.292Z,
originalError:
{ code: 'EHOSTUNREACH',
errno: 'EHOSTUNREACH',
syscall: 'connect',
address: '169.254.169.254',
port: 80,
message: 'connect EHOSTUNREACH 169.254.169.254:80' } } }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `claudia create --name hello-world --region us-east-1 --handler main.handler`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/interact/.npm/_logs/2018-06-13T07_50_47_317Z-
debug.log
and the message is :
enter code here`message: 'Could not load credentials from any providers'
I search on SF and on net but nothing found that can solve my problem.
my node version is v8.11.3
and npm version is 5.6.0
Upvotes: 1
Views: 964
Reputation: 11
You can add AWS_PROFILE=profile_name to your package.json file. This will set the profile just for that command. This is useful if you have multiple projects with different accounts.
For example:
"scripts": {
"start": "AWS_PROFILE=claudia claudia create --name hello-world --region us-east-1 --handler main.handler",
"test": "AWS_PROFILE=claudia claudia test-lambda",
"deploy": "AWS_PROFILE=claudia claudia update"
},
Upvotes: 1
Reputation: 3047
You can easily solve your issue using two way
1.By changing .aws/credentials file. Rename [claudia] to [default]
[default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxxxxx
2.Set the AWS_PROFILE environment variable.
AWS_PROFILE=deployment claudia <options>
if you want multiple AWS cli users you can add using this way.
Modify .aws/credentials file
[default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxxxxx
[claudia]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxx
Upvotes: 4