Hi everyone,
I am working on C2W3 Lab 2 – CloudWatch, and I am having an issue with AWS authentication when setting up the lab.
I started from the provided lab environment and ran:
source scripts/setup.sh
The script completes with:
“Setup completed successfully. All environment variables and Terraform backend configurations have been set.”
However, during the setup process I also get the following AWS errors:
An error occurred (AuthFailure) when calling the DescribeVpcs operation:
Authorization header or parameters are not formatted correctly.
An error occurred (AuthFailure) when calling the DescribeSubnets operation:
Authorization header or parameters are not formatted correctly.
The same error appears multiple times.
When I continue with Terraform, I get:
Error: No valid credential sources found
with module.bastion_host.provider[" Terraform Registry "],
on modules/bastion_host/providers.tf line 26, in provider “aws”:
Error: failed to refresh cached credentials, no EC2 IMDS role found,
operation error ec2imds: GetMetadata, exceeded maximum number of attempts, 3,
request send failed, Get
“http://169.254.169.254/latest/meta-data/iam/security-credentials/”: EOF
It seems that Terraform/AWS CLI cannot find or use the AWS credentials provided by the lab environment.
I have not manually changed the Terraform configuration.
Could someone please advise me on how to restore/fix the AWS credentials in this lab environment?
I would also like to know whether I should reset/refresh the lab environment or if there is a specific command I should run to reconfigure the credentials.
Thank you.


