2
1

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.

.ebextensions で環境変数を扱う方法

Posted at

Elastic Beanstalkで.ebextensionsの中で、デプロイ環境毎に切り替えたいプロパティや、コード中にいれたくないプロパティを設定したいことは多いと思います。
その場合は、下記のように、関数 Fn:GetOptionSetting を使用して、環境プロパティを参照することができます。

.ebextensions/00.option.config
option_settings:
  aws:elasticbeanstalk:environment:
    LoadBalancerType: application

  aws:elbv2:loadbalancer:
    IdleTimeout: 300

  aws:elbv2:listener:443:
    DefaultProcess: default
    ListenerEnabled: 'true'
    Protocol: HTTPS
    SSLCertificateArns:
      "Fn::GetOptionSetting":
        Namespace: "aws:elasticbeanstalk:application:environment"
        OptionName: "ACM_CERT_ARN"
        DefaultValue: ""

あとはeb環境作成時に、環境プロパティを設定すればOKです。

$ eb create --envvars "ACM_CERT_ARN=${cert_arn}" newenv

Fn:GetOptionSetting ではネームスペースや、オプション名の選択で、他の各種設定も取得できます。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?