Packer: Packer AWS build failed with AuthFailure

Created on 3 Jun 2015  路  3Comments  路  Source: hashicorp/packer

I was trying to build AMI using below JSON -

{
  "variables": {
    "aws_access_key": "",
    "aws_secret_key": ""
  },
  "builders": [{
    "type": "amazon-ebs",
    "access_key": "{{user `aws_access_key`}}",
    "secret_key": "{{user `aws_secret_key`}}",
    "region": "us-east-1",
    "source_ami": "ami-9eaa1cf6",
    "instance_type": "t2.micro",
    "ssh_username": "ubuntu",
    "ami_name": "packer-example {{timestamp}}"
  }],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "sleep 30",
      "sudo apt-get update",
      "sudo apt-get install -y redis-server"
    ]
  }]
}

Executing below command to build it -

packer build -var 'aws_access_key=xxxx' -var 'aws_secret_key=xxxx' /EBS/packer-templates/EC2.json

But always getting error --

==> amazon-ebs: Error querying AMI: AuthFailure: AWS was not able to validate the provided access credentials
==> amazon-ebs: status code: 401, request id: []
Build 'amazon-ebs' errored: Error querying AMI: AuthFailure: AWS was not able to validate the provided access credentials
status code: 401, request id: []

Could anyone please help why I'm getting these error? I'm providing valid access key and secret key.

bug buildeamazon

Most helpful comment

Regret! Closing the issue. It was an issue of time drift at the server. After setting the time properly able to move ahead.

All 3 comments

Hi @sourav82

Thank you for opening an issue. We recently did a large triage of Packer and fixed many issues but have not done a release yet. Could you please try building from master and see if this problem still exists? Thanks!

@sethvargo Thanks for reply. I just built it (make dev) from master and tried but got the same issue.

Except the access key and secret key anything else do I need to provide (like user id/ password) to build image in AWS?

Regret! Closing the issue. It was an issue of time drift at the server. After setting the time properly able to move ahead.

Was this page helpful?
0 / 5 - 0 ratings