Skip to content

Can you explicitly tell the awscli to ignore the AWS_PROFILE var when executing the CLI from the command line? #6677

@clanesf

Description

@clanesf

Confirm by changing [ ] to [x] below:

Issue is about usage on:

  • Service API : I want to do X using Y service, what should I do?
  • [x ] CLI : passing arguments or cli configurations.
  • Other/Not sure.

Platform/OS/Hardware/Device
What are you running the cli on?
Centos/Linux/K8s/Cloud

Describe the question
Ran into this and had a question/feature request.. is there any way to override the AWS_PROFILE value in the CLI to tell it to not use a profile. Something like aws --no-profile or even honoring aws --profile=''.

In my case AWS credentials are set via environment variables in one environment only, and it would be nice to have a way to not have the cli crash if for whatever reason the AWS_PROFILE is set (i.e. to default)

I was able to workaround this by stubbing in a ~/.aws/config with

[default]
output=json

but touching the file system inside k8s containers isn't as easy as setting an ENV.

My code caused the AWS_PROFILE to be set, so the fix is easy - you can just unset AWS_PROFILE, but It would be nice to have the option to explicitly exclude the profile or an option to define the profile contents via an environment variable.

Logs/output
Get full traceback and error logs by adding --debug to the command.

UPDATE: did a little more digging around and it looks like there has been discussion about when to honor the profile environment and when to honor the CLI argument.
That might make this "asked and answered"

Metadata

Metadata

Assignees

Labels

configurationguidanceQuestion that needs advice or information.investigatingThis issue is being investigated and/or work is in progress to resolve the issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions