I have been using the plugin: amazon.aws.aws_ec2 successfully for a while now.
I was successfully using aws-azure-login to get my AWS credentials, which works when it works but aws-azure-login doesn’t always work and has consumed many of my hours trying to restore functionality when it stopes working.
Today I tried use the ‘aws login’ which is part of the AWS CLI.
Login for AWS local development using console credentials - AWS Command Line Interface
I can log in and use the cli without issue, but the dynamic inventory plugin seems to be unaware of it.
I have tried exporting the variables:
eval "$(aws configure export-credentials --profile your-profile-name --format env)"
which seems to have worked
echo $AWS_ACCESS_KEY_ID
****************APD6
except that the dynamic library still isn’t working.
Any thoughts on what I might be missing or how I go about troubleshooting this?
For testing, I am just trying to list a single inventory file:
ansible-inventory -i honorapp_aws_ec2.yaml --list
[WARNING]: Unable to parse honorapp_aws_ec2.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
"_meta": {
"hostvars": {},
"profile": "inventory_legacy"
},
"all": {
"children": [
"ungrouped"
]
}
}
but I am logged in
aws configure export-credentials --format env
export AWS_ACCESS_KEY_ID=****************APD6
export AWS_SECRET_ACCESS_KEY=****************mRCM
export AWS_SESSION_TOKEN=****************8lXIQ=
export AWS_CREDENTIAL_EXPIRATION=2026-04-27T20:43:29+00:00
and I can use the CLI without issue.
As a hail mary, I tried grabbing the keys from the environment:
# The access key for your AWS account.
aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
# The secret access key for your AWS account.
aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
but with the same inventory result.
I am starting to think that whatever broke my aws-azure-login might have somehow also broken my dynamic inventory, which seems unlikely but …
Please help before I lose what is left of my mind.