Hello Packer Community -

New to Packer and following a course in Packer. Using Packer 1.7.2 on Ubun 
20.10.

Trying to deploy to AWS and I am running under an user I created in AWS 
which is part of group Administrator and has all privileges. I am running 
in a vagrant box as it allows me to keep to latest toolsets. This is shown 
below.
----------
My packer validate passes but packer build fails:
amazon-ebs: output will be in this color.
Build ‘amazon-ebs’ errored after 6 seconds 147 milliseconds: no valid 
credential sources for found.

Please see for more information about providing credentials.
Error: NoCredentialProviders: no valid providers in chain. Deprecated. For 
verbose messaging see aws.Config.CredentialsChainVerboseErrors
==> Wait completed after 6 seconds 148 milliseconds
==> Some builds didn’t complete successfully and had errors: –> amazon-ebs: 
no valid credential sources for found.
----------
I am using AWS CLI 2 and credentials file + config file are ok.
In fact sts get caller-identitity returns fine.

vagrant@vbUBUNiINFRA1:~$ aws.sts.get-caller-identity
3304XXXX arn:aws:iam::3304XXXX:user/mono-acc.adm XXXXXXXXXXXXX
vagrant@vbUBUNiINFRA1:~$ aws.version
aws-cli/2.2.5 Python/3.8.8 Linux/5.8.0-53-generic exe/x86_64.ubuntu.20 
prompt/off
----------
The file I am trying to validate is as follows:
The ssh-username  (below)is the only thing I change from the example (in 
book) to the default user in my credentials file based on which sts caller 
identity runs.
----------
{
    "variables": {
        "region": "AWS REGION",
        "aws_profile": "AWS PROFILE",
        "source_ami": "AMAZON LINUX AMI ID",
        "instance_type": "EC2 INSTANCE TYPE"
    },
    "builders": [
        {
            "type": "amazon-ebs",
            "profile": "{{user `aws_profile`}}",
            "region": "{{user `region`}}",
            "instance_type": "{{user `instance_type`}}",
            "source_ami": "{{user `source_ami`}}",
            "ssh_username": "mono-acc.adm",
            "ami_name": "jenkins-master-2.204.1",
            "ami_description": "Amazon Linux Image with Jenkins Server",
            "source_ami_filter": {
                "filters": {
                "virtualization-type": "hvm",
                "name": "Amazon Linux AMI-*",
                "root-device-type": "ebs"
                },
                "owners": ["amazon"],
                "most_recent": true
            }
        }                
    ],
        "provisioners": [
            {
                "type": "shell",
                "script": "./setup.sh",
                "execute_command": "sudo -E -S sh '{{ .Path }}'"
            }
        ]
    }
----------
Any suggestions is much appreciated.
Thank you.
Mono

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/3cae3867-f000-443e-a114-1ddae2da2b64n%40googlegroups.com.

Reply via email to