Setting environment variables during Elastic Beanstalk deployment

Dario Segura's Avatar

Dario Segura

14 Feb, 2019 02:11 PM

Hello,
I am trying to deploy to Elastic Beanstalk using the new EBS deployment type and have the deployment process set the environment variables using a powershell script such as deploy.ps1 (which does not appear to be running)
I believe there is a way to specify in the deployment manifest to run some scripts but what I am not sure of is if this script will have access to the environment variables defined in the appveyor environment.

Thanks.

  1. Support Staff 1 Posted by Ilya Finkelshte... on 14 Feb, 2019 06:29 PM

    Ilya Finkelshteyn's Avatar

    Hi Dario,

    We certainly need more details to help.

    • What is "new EBS deployment type"?
    • Do you use AppVeyor EBS deployment?
    • Do you use environment or inline deployment (difference here)?
    • Can you please send your build configuration in YAML format (Export YAML button if you use UI) and deployment screenshot (if you use environment deployment)?

    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,

    Ilya.

  2. 2 Posted by Dario Segura on 15 Feb, 2019 04:20 AM

    Dario Segura's Avatar

    Hi Ilya,

     - By "new EBS deployment type" I was referring to the "Amazon Elastic Beanstalk" environment
     - Yes, I am using the AppVeyor EBS deployment
     - I am using the inline deployment

    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.

    Thanks,
    Dario

  3. Support Staff 3 Posted by Ilya Finkelshte... on 15 Feb, 2019 11:46 PM

    Ilya Finkelshteyn's Avatar

    Ah I see...

    Those are different deployment providers:

    • Deployment agent works when AppVeyor Deployment agent in installed on the target machine. Sure in this case we can pass environment variables and consume them in deploy.ps1 script.
    • mazon Elastic Beanstalk calls AWS API using .NET SDK pretty much the same way as awsdeploy.exe does.

    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 AWS run command. 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.

  4. 4 Posted by Dario Segura on 25 Feb, 2019 04:24 AM

    Dario Segura's Avatar

    Thanks Ilya,

    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.
    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?

    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.

    Your help would be very appreciated.
    Thanks,
    Dario

  5. Support Staff 5 Posted by Ilya Finkelshte... on 25 Feb, 2019 10:21 PM

    Ilya Finkelshteyn's Avatar

    Hi Dario,

    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 with API.
    Please check those parts of documentation:

    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.

    Did you look at settings required variables in EBS environment software settings as described here? Also how your "postInstall" powershell script is going to be called?

    Ilya.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

20 Mar, 2019 01:15 PM
20 Mar, 2019 11:09 AM
20 Mar, 2019 10:37 AM
20 Mar, 2019 09:01 AM
20 Mar, 2019 08:51 AM

 

20 Mar, 2019 02:33 AM
19 Mar, 2019 06:21 PM
19 Mar, 2019 06:03 PM
19 Mar, 2019 05:22 PM
19 Mar, 2019 05:08 PM
19 Mar, 2019 05:00 PM