Inputting Access_Key and Secret Key variables for AMI build using Packer container does not work with AWS

I am trying to do AMI buids with Packer and this works fine using Packer container on Linux and Mac. But on Windows Linux clients it is not working

Getting the below error. Even tried hard coding the access_key and secret_key to the builders section. still same issue
Build ‘amazon-ebs’ errored: error validating regions: AuthFailure: AWS was not able to validate the provided access credentials
status code: 401, request id: 3b4341b8-4c3d-4ac9-8bfb-1971e4c4faf5

==> Some builds didn’t complete successfully and had errors:
–> amazon-ebs: error validating regions: AuthFailure: AWS was not able to validate the provided access credentials
status code: 401, request id: 3b4341b8-4c3d-4ac9-8bfb-1971e4c4faf5

@ninoyr17
I am also facing the same issue in Ubuntu WSL .I have also tried with Variables and credentials folder but doesn’t work
Have you figured out a solution for this ?

Try setting the environment variables
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN

Yes I exported the keys as environment variables and it worked
Thank you

What if we not set the env variables and use iam instance profile instead, does it work?

Hi icodeiexist

Will you please take a look at my post - do you think it is the same problem?

Thank you.