Packer unable to fetch IAM profile

Hello Hello,

Can some one please help me with the below error while trying to build a windows AMI with packer.

2021/10/15 04:34:12 packer-builder-amazon-ebs plugin: Using specified security groups: [sg-0ec2fe6b03473fc54 sg-05133a52385240cee sg-06d3e8e753135e217 sg-0e1c0aab611d38622 sg-09d606518c08ca9e4]
474 2021/10/15 04:34:12 packer-builder-amazon-ebs plugin: Error asking for input: no available tty
475 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: [DEBUG] Couldn’t find specified instance profile: RequestError: send request failed
476 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: caused by: Post “https://iam.amazonaws.com/”: dial tcp 52.46.155.37:443: i/o timeout
477 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: Error asking for input: no available tty
478 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: Error asking for input: no available tty
479 ==> amazon-ebs.windows: Deleting temporary keypair…
480 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: Error asking for input: no available tty
481 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: Error asking for input: no available tty
482 2021/10/15 04:40:31 packer-builder-amazon-ebs plugin: Error asking for input: no available tty
483 2021/10/15 04:40:31 [INFO] (telemetry) ending
484 caused by: Post “https://iam.amazonaws.com/”: dial tcp 52.46.155.37:443: i/o timeout
485 2021/10/15 04:40:31 Waiting on builds to complete…
486 ==> Wait completed after 6 minutes 20 seconds
487 2021/10/15 04:40:31 machine readable: error-count string{“1”}
488 ==> Some builds didn’t complete successfully and had errors:
489 2021/10/15 04:40:31 machine readable: amazon-ebs.windows,error string{“Couldn’t find specified instance profile: RequestError: send request failed\ncaused by: Post “https://iam.amazonaws.com/”: dial tcp 52.46.155.37:443: i/o timeout”}
490 caused by: Post “https://iam.amazonaws.com/”: dial tcp 52.46.155.37:443: i/o timeout
491 ==> Builds finished but no artifacts were created.
492 2021/10/15 04:40:31 [INFO] (telemetry) Finalizing.
493 Build ‘amazon-ebs.windows’ errored after 6 minutes 20 seconds: Couldn’t find specified instance profile: RequestError: send request failed
494 caused by: Post “https://iam.amazonaws.com/”: dial tcp 52.46.155.37:443: i/o timeout
495
496 ==> Wait completed after 6 minutes 20 seconds
497
498 ==> Some builds didn’t complete successfully and had errors:
499 → amazon-ebs.windows: Couldn’t find specified instance profile: RequestError: send request failed
500 caused by: Post “https://iam.amazonaws.com/”: dial tcp 52.46.155.37:443: i/o timeout

For some reason the system is unable to get instance profile. I am not sure what is missing.

I have checked the instance profile and it is valid. I am using Packer version 1.7.6