6
2

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 3 years have passed since last update.

packerでAWSのプロファイルを指定する方法

Last updated at Posted at 2019-09-04

variablesにaws_profileを宣言し、環境変数(env)から取得するようにします。
builderのprofileにその変数を使うように指定します。

{
  "min_packer_version": "1.4.2",
  "variables": {
    "aws_region": "ap-northeast-1",
    "aws_profile": "{{env `AWS_PROFILE`}}"
  },
  "builders": [
    {
      "profile": "{{user `aws_profile`}}"
    }
  ]
}

実行

AWS_PROFILE=sandbox packer build ファイル
6
2
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
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?