AuthFailure: Credential must have exactly 5 slash-delimited elements

hi, I’m using iam_instance_profile to build ami image in amazon and receive this error message while run packer build

mazon-ebs: error validating regions: AuthFailure: Credential must have exactly 5 slash-delimited elements, e.g. keyid/date/region/service/term

here my template:

{
“builders”: [
{
“ami_name”: “mediba-wordpress-{{isotime | clean_resource_name}}”,
“custom_endpoint_ec2”: “https://ec2.ap-northeast-1.amazonaws.com”,
“force_deregister”: true,
“iam_instance_profile”: "user instance_profile",
“instance_type”: "user instance_type",
“launch_block_device_mappings”: {
“device_name”: “/dev/sda1”,
“encrypted”: true,
“volume_size”: 30,
“volume_type”: "user volume_type"
},
“region”: "user region",
“security_group_id”: “user sg_default", "source_ami_filter": { "filters": { "root-device-type": "ebs", "virtualization-type": "hvm" }, "most_recent": true, "owners": [ "user image_owner" ] }, "ssh_agent_auth": true, "ssh_keypair_name": "user keypair", "ssh_username": "user ssh_user", "type": "amazon-ebs", "tags": { "Name": "user name`”
}
}
],

I think people sometimes get this issue when they accidentally switch their access_key and secret_key

1 Like

So, we need to provide aws credential even using instance profile?