1
0

More than 3 years have passed since last update.

aws-vaultを用いてAWS SAMローカル実行をIDE上で行う方法。

Posted at

事前設定

IDEはPyCharmを使用します。
AWS Toolkit for PyCharmのPluginインストール

アクセスキーによる認証ではなく、aws-vaultにて認証処理

  • ~/.aws/config にて[default]にcredential_process追加します。
    ※credential_processとは外部プロセスの標準出力から認証情報を取得する仕組みとのことです。セキュリティ面の考慮が必要であることに留意してください。

  • 通常使用しているprofileはそのままで大丈夫です。なければ追記をお願いします。

[default]
region = ap-northeast-1
credential_process = aws-vault exec --json default

[profile pycharm-test]
source_profile = default
role_arn = arn:aws:iam::xxxxxxxxxxxxxxxxxxxxxx
region = ap-northeast-1

以上で設定完了です。

おまけ

コマンドによる実行方法

sam build [SAMリソース名] && aws-vault exec pycharm-test -- sam local invoke [SAMリソース名]

参考
https://github.com/99designs/aws-vault/blob/master/USAGE.md#using-credential_process

1
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
1
0