[英]Getting Error 'NoCredentialProviders: no valid providers in chain. Deprecated.' while calling acmpca.GetCertificate() in golang
I am facing error while calling acmpca.GetCertificate() function to get certificate,我在调用 acmpca.GetCertificate() function 获取证书时遇到错误,
NoCredentialProviders: no valid providers in chain
caused by: EnvAccessKeyNotFound: AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment
SharedCredsLoad: failed to load shared credentials file
caused by: FailedRead: unable to open file
caused by: open /root/.aws/credentials: no such file or directory
EC2RoleRequestError: no EC2 instance role found
caused by: RequestError: send request failed
caused by: Get "http://169.254.169.254/latest/meta-data/iam/security-credentials/": dial tcp 169.254.169.254:80: connect: no route to host
My AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY is stored in ~/.aws/credentials file, below is the code我的 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 存储在 ~/.aws/credentials 文件中,下面是代码
sess := acmpca.New(session.New(&aws.Config{
Region: aws.String("us-east-1"),
}))
params := &acmpca.GetCertificateInput{
CertificateArn: aws.String("ARN"),
CertificateAuthorityArn: aws.String("ARN"),
}
resp, err := sess.GetCertificate(params)
if err != nil {
fmt.Println("got error := ", err.Error())
}
fmt.Printf("++++ response ++++:= %+V", resp)
Can anyone please help me on this?谁能帮我解决这个问题? Thanks in advance!
提前致谢!
The credentials you provided are either expired or they don't have proper permissions set for them.您提供的凭据已过期或没有为其设置适当的权限。 You can try creating new credentials with permissions that are sufficient for code.
您可以尝试创建具有足够代码权限的新凭据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.