如何查看CLI的默认配置文件? [英] How to see what profile is default with CLI?

查看:58
本文介绍了如何查看CLI的默认配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于我有以下配置文件:

Given I have the following config file:

[default]
aws_access_key_id=default_access_key
aws_secret_access_key=default_secret_key

[profile testing]
aws_access_key_id=testing_access_key
aws_secret_access_key=testing_secret_key
region=us-west-2

给定我的默认配置文件的名称是 foo

And given the name of my default profile is foo

我需要输入哪些CLI命令来获取默认配置文件的名称.像这样:

What CLI commands do I need to type in to get the name of my default profile. Something like:

$ aws describe-default-profile

{
    ...
    "default_profile_name": 'foo'
}

或列出所有配置文件,并且也输出默认配置文件:

Or list all profiles and it ouputs the default too:

$ aws list-all-profiles

{
    [{
        ...
        profile_name: 'foo',
        "is_default": true
    }]
}

iam 上有一个 get-instance-profile (

There is a get-instance-profile on iam (docs), but it requires the name of the profile be specified:

$ aws iam get-instance-profile --instance-profile-name ExampleInstanceProfile

推荐答案

您可以运行 aws configure list 列出您的当前配置文件

You can run aws configure list to list your current profile

列出AWS CLI配置数据.该命令将向您显示当前配置数据.对于每个配置项目,它将显示您的值,在其中检索配置值的位置,以及配置变量名称.例如,如果您提供AWS环境变量中的区域,此命令将为您显示名称所配置区域的数量,它将告诉您该值来自从一个环境变量中,它会告诉您环境变量.

List the AWS CLI configuration data. This command will show you the current configuration data. For each configuration item, it will show you the value, where the configuration value was retrieved, and the configuration variable name. For example, if you provide the AWS region in an environment variable, this command will show you the name of the region you've configured, it will tell you that this value came from an environment variable, and it will tell you the name of the environment variable.

显示当前配置值:

      $ aws configure list
            Name                    Value             Type    Location
            ----                    -----             ----    --------
         profile                <not set>             None    None
      access_key     ****************ABCD      config_file    ~/.aws/config
      secret_key     ****************ABCD      config_file    ~/.aws/config
          region                us-west-2              env    AWS_DEFAULT_REGION

如果要查看特定配置文件的配置,可以运行 aws configure list --profile foo

If you want to review your configuration for a specific profile, you can run aws configure list --profile foo

这篇关于如何查看CLI的默认配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆