aws-cli - 如何删除 aws 配置文件?

要在 aws cli 中创建自定义配置配置文件,我使用以下命令:

aws configure --profile user1

但是,我找不到任何命令来删除我的个人资料之一。

回答1

嗨,您需要一个命令还是只需要删除配置文件?

您可以编辑:Windows

C:\Users\USERNAME\.AWS\credentials
C:\Users\USERNAME\.AWS\config
    
(%USERPROFILE%\.aws\config 
%USERPROFILE%\.aws\credentials)

或者

Linux 和 macOS

~/.aws/config ~/.aws/credentials
~/.aws/config ~/.aws/config

如果您担心多次这样做,您可以使用 powershell 或 sed 创建一个脚本...

Get-Content test.txt) | ForEach-Object { $_ -replace "<profile>", "" } | Set-Content C:\Users\USERNAME.AWS\config

或者

sed -i 's/"[profile profile]//g' ~/.aws/config

重要提示:您需要将替换写入有关您的除非配置文件的所有行,我也应该为您的凭据文件执行此操作。

相似文章

随机推荐

最新文章