我尝试将aws
与ClaudiaJS一起使用,所以首先我从claudiajs github下载hello world example,然后在我的aws上创建一个包含这些AWSLambdaFullAccess
的用户,{{1}然后使用IAMFullAccess
配置AmazonAPIGatewayAdministrator
文件,并将配置文件名称从默认值更改为claudia,现在我的凭据是这样的:
.aws/credentials
之后根据教程我运行awscli
然后[claudia]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxx
。脚本是这样的:
npm i
但在npm start
之后我收到了这些错误:
"scripts": {
"start": "claudia create --name hello-world --region us-east-1 --handler main.handler",
"test": "claudia test-lambda",
"deploy": "claudia update"
},
,消息是:
npm start
我在SF和网上搜索但没有发现可以解决我的问题。
我的节点版本为npm start
> hello-world@1.0.0 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! hello-world@1.0.0 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 hello-world@1.0.0 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
,npm版本为 enter code here`message: 'Could not load credentials from any providers'
答案 0 :(得分:2)
您可以使用双向轻松解决问题
1.通过更改.aws / credentials文件。将[claudia]重命名为[default]
[default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxxxxx
2.设置AWS_PROFILE环境变量。
AWS_PROFILE=deployment claudia <options>
如果您想要多个AWS cli用户,可以使用这种方式添加。
修改.aws /凭证文件
[default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxxxxx
[claudia]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxx
答案 1 :(得分:1)
您可以将AWS_PROFILE = profile_name 添加到package.json文件。这将仅为该命令设置配置文件。如果您有多个具有不同帐户的项目,这将很有用。
例如:
text/plain