0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】任意の場所の.aws/ディレクトリを参照するように設定したい

Last updated at Posted at 2025-08-16

はじめに

特定のプロジェクトで、AWSアカウントやIAMロールが異なる場合があります。

そのような場合、ホームディレクトリ直下ではない、任意の場所にある.aws/ディレクトリを参照するように設定するには、環境変数AWS_CONFIG_FILEAWS_SHARED_CREDENTIALS_FILEを使用します。

設定方法

  1. AWS_CONFIG_FILE:AWS CLIの設定ファイル(config)の場所を指定
  2. AWS_SHARED_CREDENTIALS_FILE:認証情報ファイル(credentials)の場所を指定

例えば、~/myproject/aws_config/ディレクトリに設定ファイルがある場合、以下のように環境変数を設定します。

export AWS_CONFIG_FILE="/path/to/your/custom/aws_config/config"
export AWS_SHARED_CREDENTIALS_FILE="/path/to/your/custom/aws_config/credentials"

おわり

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?