简体   繁体   中英

Getting error using credentials to get accountid:getcalleridentity in aws -terraform

I created an aws account and an IAM user for terraform -administrator access and got my credentials. I am now trying to create an EC2 instance in AWS using terraform.I am running the below terraform script from git bash.

provider "aws"{
access_key = "Axxxxxxxxx"
secret_key = "Lxxxxxxxxxxxxxx"
region="us-east-1"
}
resource "aws_instance" "example"{
ami="ami-0323c3dd2da7fb37d"
instance_type="t2.micro"
}

When i give terraform plan,I am getting the following error:

Error: error using credentials to get account ID: error calling sts:GetCallerIdentity: SignatureDoesNotMatch: Signature not yet current: 20200518T060344Z is still later than 20200518T041739Z (20200518T040239Z + 15 min.)
        status code: 403, request id: 7d93e368-bf05-4110-9876-1bf6064dd255

  on instance.tf line 1, in provider "aws":
   1: provider "aws"{

I am new to AWS as well as terraform.Can you please let me know why this error appears?I tried updating the git bash.If I am missing out something,please let me know.

Your system clock may be miss-configured.

From this AWS forum thread:

API services verify timestamps to be within 5 minutes of actual time. If the system clock is off by more than 5 minutes, then the API requests will fail .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM