gpt4 book ai didi

node.js - AWS 的 Claudiajs hello 词示例中未加载凭证

转载 作者:太空宇宙 更新时间:2023-11-04 03:20:37 25 4
gpt4 key购买 nike

我尝试将 awsClaudiaJS 一起使用所以首先我下载hello world example来自 claudiajs github,然后在我的 aws 上使用这些 AWSLambdaFullAccessIAMFullAccessAmazonAPIGatewayAdministrator 创建用户,然后使用 awscli 配置 .aws/credentials 文件,并将配置文件名称从默认值更改为 claudia,现在我的凭证如下所示:

[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 之后我收到这些错误:

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

消息是:

  enter code here`message: 'Could not load credentials from any providers'

我在SF和网上搜索,但没有找到可以解决我的问题。

我的 Node 版本是v8.11.3,npm版本是5.6.0

最佳答案

您可以使用两种方式轻松解决您的问题

1.通过更改 .aws/credentials 文件。将 [claudia] 重命名为 [默认]

 [default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxxxxx

2.设置AWS_PROFILE环境变量。

AWS_PROFILE=deployment claudia <options>

如果您想要多个 AWS cli 用户,可以使用这种方式添加。

修改 .aws/credentials 文件

[default]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxxxxxxx

[claudia]
aws_access_key_id = xxxxxxxxx
aws_secret_access_key = xxxx

关于node.js - AWS 的 Claudiajs hello 词示例中未加载凭证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50832048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com