Task:
Create an EC2 key pair named devops-kp with key type rsa in the us-east-1 region using AWS CLI.
What I attempted:
I ran the following command on the aws-client host:
aws ec2 create-key-pair
–region us-east-1
–key-name devops-kp
–key-type rsa
–query ‘KeyMaterial’
–output text > devops-kp.pem
Issue faced:
All AWS CLI commands (including describe-regions) fail with the error:
AuthFailure: AWS was not able to validate the provided access credentials.
The showcreds command only provides AWS Console credentials and does not expose access keys, session tokens, or an IAM role for CLI usage. Because of this, the AWS CLI cannot authenticate in this lab environment.
Question:
Is this expected behavior for this lab, or is there a missing step to enable AWS CLI authentication (IAM role or access keys) on the aws-client host?