【问题标题】:Getting error using credentials to get accountid:getcalleridentity in aws -terraform在 aws -terraform 中使用凭证获取 accountid:getcalleridentity 时出错
【发布时间】:2020-09-03 19:44:46
【问题描述】:

我为 terraform -administrator 访问创建了一个 aws 帐户和一个 IAM 用户,并获得了我的凭据。 我现在正在尝试使用 terraform 在 AWS 中创建一个 EC2 实例。我正在从 git bash 运行以下 terraform 脚本。

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

当我给出 terraform 计划时,我收到以下错误:

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"{

我是 AWS 和 terraform 的新手。您能告诉我为什么会出现此错误吗?我尝试更新 git bash。如果我遗漏了什么,请告诉我。

【问题讨论】:

    标签: amazon-web-services amazon-ec2 terraform


    【解决方案1】:

    您的系统时钟可能配置错误。

    来自this AWS 论坛帖子:

    API 服务会验证时间戳在实际时间的 5 分钟 内。如果系统时钟关闭超过 5 分钟,则 API 请求将失败

    【讨论】:

    • 出于某种原因,我的 WSL Ubuntu-18.04 上的时钟突然发生了变化。执行wsl --shutdown 重新启动了 WSL 实例并且日期得到更正。
    猜你喜欢
    • 2021-09-03
    • 2021-02-28
    • 1970-01-01
    • 2019-01-02
    • 2021-02-05
    • 2021-01-15
    • 2017-06-07
    • 2022-08-08
    • 2019-08-15
    相关资源
    最近更新 更多