Unable to build AMI's with provided packer templates, returning an S3 related error

2.5k views Asked by At

I am following this guide which provides packer templates to create AMI's https://github.com/scarolan/vault-aws-cf

The problem is that I'm new to packer and seeing the following error:

Build 'amazon-ebs' errored after 5 seconds 898 milliseconds: Couldn't find specified instance profile: NoSuchEntity: Instance Profile Packer-S3-Access cannot be found.
    status code: 404, request id: 8c62db59-fdaa-4150-bd43-883415839ce6

==> Wait completed after 5 seconds 898 milliseconds

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Couldn't find specified instance profile: NoSuchEntity: Instance Profile Packer-S3-Access cannot be found.

I am attempting to build the vault.json by using:

packer build \ -var 'aws_access_key=<enter-key-here>' \ -var 'aws_secret_key=<enter-key-here>' \ vault.json

Am I missing several arguments in the packer build or do I need to edit the packer template files with relevant AWS information?

1

There are 1 answers

1
user2599522 On BEST ANSWER

From the vault.json i can see that Packer-S3-Access is a user defined input which is then used as the iam_instance_profile in packer.

{
  "description": "Vault and Consul Client Configuration for Vault.",
  "variables": {
    // snip
    "inst_profile": "Packer-S3-Access",
  },
  "builders": [
    {
      // snip
      "iam_instance_profile": "{{user `inst_profile`}}",

Since its a user input, you have not defined an instance profile in your AWS account with that name.