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?

More than 1 year has passed since last update.

AWS Cloud9におけるインスタンスプロファイルの利用(Proxy環境下)

Posted at

あまりない構成だと思うが記載しておく

構成(環境)

  • Cloud9を利用
  • Cloud9が配置しているサブネットはインターネットに直接アクセスを行わないようにし、Proxy経由でインターネットにアクセスする
  • Cloud9の~/.bashrcに以下のようにProxy設定をしている
  • Cloud9はATMC(AWS AWS managed temporary credentials)を無効にしており、インスタンスプロファイルを利用している
~/.bashrc
export http_proxy=http://xxx.xxx.xxx:8080
export https_proxy=http://xxx.xxx.xxx:8080

IAMロールのCredential情報がCloud9に引き継がれない

上記Proxyを設定している状態でCloud9にてaws configure listを実行するとインスタンスプロファイルからCredential情報が引き渡っていないことを確認

aws configure listの結果①
Name           Value            Type           Location
---            ---              ---            ---    
profile        <not set>        None           None
access_key     <not set>        None           None
secret_key     <not set>        None           None
region         ap-northeast-1   config-file    ~/.aws/config

インスタンスメタデータへのアクセスはProxy除外しなければならない

  • ~/.bashrcにてProxy設定をしていたが、インスタンスメタデータへのアクセスもProxy経由で取得しようとしていた為、接続できず、Credential情報が引き渡っていなかった。
  • Proxy設定をいれている~/.bashrcにてNO_PROXYを追加しインスタンスメタデータへのアクセスはProxy経由にしないようにする
~/.bashrc
export http_proxy=http://xxx.xxx.xxx:8080
export https_proxy=http://xxx.xxx.xxx:8080
export NO_PROXY=169.254.169.254 # ←追加
  • 除外設定を追加したところCredential情報が引き渡ってることを確認
aws configure listの結果②
Name           Value            Type           Location
---            ---              ---            ---    
profile        <not set>        None           None
access_key     *****5GDH        iam-role
secret_key     *****VDI8        iam-role
region         ap-northeast-1   config-file    ~/.aws/config

参考記事

あとがき

インスタンスプロファイルのアクセスをすっかり失念していた。

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?