11

I have an IAM user adminuser which is in the Administrators group (having AdministratorAccess).

I have used aws configure to set up the settings.

~/.aws/config

[default]
region = us-east-1
output = json

~/.aws/credentials

[default]
aws_access_key_id = ************
aws_secret_access_key = ************

But when I run aws lambda list-functions --profile adminuser, it says

The config profile (adminuser) could not be found

Once I run export AWS_DEFAULT_PROFILE=adminuser, and run aws lambda list-functions --profile adminuser again, it shows:

botocore.exceptions.ProfileNotFound: The config profile (adminuser) could not be found

I read AWS CLI Config profile not found. So I try to changed to

~/.aws/config

[adminuser]
region = us-east-1
output = json

~/.aws/credentials

[adminuser]
aws_access_key_id = ************
aws_secret_access_key = ************

and run aws lambda list-functions --profile adminuser again, then it shows:

You must specify a region. You can also configure your region by running "aws configure".

I also tried this like the official AWS document demo

~/.aws/config

[default]
region = us-east-1
output = json

[adminuser]
region = us-east-1
output = json

~/.aws/credentials

[default]
aws_access_key_id = ************
aws_secret_access_key = ************

[profile adminuser]
aws_access_key_id = ************
aws_secret_access_key = ************

But still failed.

How can I run aws lambda list-functions --profile adminuser successfully? Thanks

5 Answers 5

15

I finally succeed by using

~/.aws/config

[default]
region = us-east-1
output = json

~/.aws/credentials

[adminuser]          // <- here changes to adminuser
aws_access_key_id = ************
aws_secret_access_key = ************
region = us-east-1   // <- note this line
1
  • 1
    Thanks! I was working through the docs for aws-lambda and found the same issue. The AWS docs need some updating here.
    – Apie
    Mar 20, 2017 at 7:52
1

Instead of using aws lambda list-functions --profile adminuser you can use aws lambda list-functions --profile default

and it will be done.

OR you may like to change "default" to "adminuser", that you have done.

This is not like the documentation is incorrect or something like that.

0

I faced the same issue with Jenkins on windows, I copied .aws folder from my profile to system profile C:\Windows\System32\config\systemprofile\ without changing Jenkins service i.e. Jenkins service runs on local system account. Then windows batch jobs on Jenkins fetches the same results as if we run in windows cmd. Moreover, I uninstalled the AWSCLI done by the pip3 method, used AWSCLI .msi type installation, hence resolved PATH issue error ( "aws command not found" during build)

-1

If you are using jenkins in windows please change log on user in windows service configuration. Restart the service. Should work.

-2

I was facing same issue, In my case config and credential files were not having read access. provided access chmod 755 for both files and issue resolved.

1
  • 2
    From a security point of view, giving 755 permission to files that have no need to be executed is horrible. And you say these files contains credentials ...
    – bgtvfr
    Apr 12, 2018 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .