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