1

I am facing error while calling acmpca.GetCertificate() function to get certificate,

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

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!

Prajwal Bhagat
  • 83
  • 1
  • 1
  • 5

1 Answers1

-1

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.