tag:help.appveyor.com,2012-11-13:/discussions/questions/34520-setting-environment-variables-during-elastic-beanstalk-deploymentAppVeyor: Discussion 2019-04-28T21:00:59Ztag:help.appveyor.com,2012-11-13:Comment/469598992019-02-14T18:29:03Z2019-02-14T18:29:03ZSetting environment variables during Elastic Beanstalk deployment<div><p>Hi Dario,</p>
<p>We certainly need more details to help.</p>
<ul>
<li>What is "new EBS deployment type"?</li>
<li>Do you use <a href="https://www.appveyor.com/docs/deployment/amazon-elastic-beanstalk/">AppVeyor EBS deployment</a>?</li>
<li>Do you use <strong>environment</strong> or <strong>inline</strong> deployment (difference <a href="https://www.appveyor.com/docs/deployment/#overview">here</a>)?</li>
<li>Can you please send your build configuration in YAML format (<code>Export YAML</code> button if you use UI) and deployment screenshot (if you use <strong>environment</strong> deployment)?</li>
</ul>
<p>Any other additional information to understand your problem is welcome. Feel free to make this thread private and remove all secrets from YAML or screenshots if any,</p>
<p>Ilya.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/469598992019-02-15T04:20:17Z2019-02-15T04:20:20ZSetting environment variables during Elastic Beanstalk deployment<div><p>Hi Ilya,</p>
<ul>
<li>By "new EBS deployment type" I was referring to the "Amazon Elastic Beanstalk" environment</li>
<li>Yes, I am using the AppVeyor EBS deployment</li>
<li>I am using the inline deployment</li>
</ul>
<p>I am able to successfully deploy via the AppVeyor agent in other environments and the environment variables defined for the environment are available when deploy.ps1 runs but that does not appear to be the case for the AppVeyor EBS deployment.</p>
<p>Thanks,<br>
Dario</p></div>Dario Seguratag:help.appveyor.com,2012-11-13:Comment/469598992019-02-15T23:46:50Z2019-02-15T23:46:50ZSetting environment variables during Elastic Beanstalk deployment<div><p>Ah I see...</p>
<p>Those are different deployment providers:</p>
<ul>
<li><a href="https://www.appveyor.com/docs/deployment/agent/">Deployment agent</a> works when AppVeyor Deployment agent in installed on the target machine. Sure in this case we can pass environment variables and consume them in <code>deploy.ps1</code> script.</li>
<li><a href="https://www.appveyor.com/docs/deployment/amazon-elastic-beanstalk/">mazon Elastic Beanstalk</a> calls AWS API using .NET SDK pretty much the same way as <code>awsdeploy.exe</code> does.</li>
</ul>
<p>If you want the same experience with AWS as you have with Deployment Agent environments, you can use AppVeyor Deployment agent on EC2 instances instead of using EBS. You can have agent baked into AMI or better install or update it when needed with <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/execute-remote-commands.html">AWS run command</a>. We have quite a few customers using AppVeyor Deployment agent on EC2 instances so we can help you with scripting if you decide to go that route.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/469598992019-02-25T04:24:23Z2019-02-25T04:24:25ZSetting environment variables during Elastic Beanstalk deployment<div><p>Thanks Ilya,</p>
<p>Running the AppVeyor deployment agent on an EC2 is straight forward, I got that running without issues, what I am wondering is how to make things work better with Amazon Elastic Beanstalk.<br>
When using the "Amazon Elastic Beanstalk" environment I can use all the settings such as environment name and application name but I still don't understand how I can use the Environment variables section. I am assuming if we can define environment variables for this type of environment is because they can be used when deploying to EBS but the question is how to access those values in EBS?</p>
<p>I do have a file called aws-windows-deployment-manifest.json that I am including in the zip file being deployed to EBS and in it I have a "postInstall" powershell script but again not sure if/how I can access the environment variables defined in AppVeyor for the environment.</p>
<p>Your help would be very appreciated.<br>
Thanks,<br>
Dario</p></div>Dario Seguratag:help.appveyor.com,2012-11-13:Comment/469598992019-02-25T22:21:15Z2019-02-25T22:21:15ZSetting environment variables during Elastic Beanstalk deployment<div><p>Hi Dario,</p>
<p>Variables in "Environment" deployments are being used to substitute deployment provider settings, not to pass to the target machine. This substitution makes sense when calling deployment environment from the build. Also environment variables can be passed when calling deployment environment <a href="https://www.appveyor.com/docs/api/environments-deployments/#start-deployment">with API</a>.<br>
Please check those parts of documentation:</p>
<ul>
<li><a href="https://www.appveyor.com/docs/deployment/environment/#overriding-environment-variables">https://www.appveyor.com/docs/deployment/environment/#overriding-en...</a></li>
<li><a href="https://www.appveyor.com/docs/deployment/agent/#overriding-settings-while-deploying-from-build">https://www.appveyor.com/docs/deployment/agent/#overriding-settings...</a></li>
</ul>
<p>Agent deployment is different from other deployment environments because with it we have a control over target machine. In other cases we do not have such luxury so environment variables set in AppVeyor are not available on the target systems.</p>
<p>Did you look at settings required variables in EBS environment software settings as described <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-softwaresettings.html">here</a>? Also how your "postInstall" powershell script is going to be called?</p>
<p>Ilya.</p></div>Ilya Finkelshteyn