`InvalidAMIID.NotFound` when deploying the same code to a new region.
BeginnerTroubleshootingAuthentication and Cloud API Errors
Answer
Likely causes → AMI IDs are region-specific; a hardcoded ami- from another region.
Diagnose → aws ec2 describe-images --image-ids ami-0abc --region ap-south-1
Fix → Look up the AMI per region with data "aws_ami" or an SSM public parameter (/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64).
Prevent → No hardcoded AMI IDs in reusable modules.
More on Authentication and Cloud API Errors
`Error: No valid credential sources found` followed by `no EC2 IMDS role found ... context deadline exceeded`.Beginner`Error: Cannot assume IAM Role` — `api error AccessDenied: User: arn:aws:iam::111111111111:user/ci is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::222222222222:role/terraform`.IntermediateGitHub Actions: `Could not assume role with OIDC: Not authorized to perform sts:AssumeRoleWithWebIdentity`.IntermediateGitHub Actions log says `It looks like you might be trying to authenticate with OIDC. Did you mean to set the id-token permission?`BeginnerApplies that run longer than an hour fail with `ExpiredToken: The security token included in the request is expired`.Intermediate`InvalidClientTokenId: The security token included in the request is invalid.`Beginner