AWS beanstalk deployments wipe out environment variables - amazon-web-services

I have an app that I am deploying through the AWS EB CLI. When I initially setup the environment, I used .ebextensions files and ran eb deploy from the terminal on my machine. This sets everything up correctly including environment variables and node version (8.9) in the beanstalk environment.
Now, if I deploy the app without the .ebextensions directory in the CI, the beanstalk environment gets spun up with default values which sets node back to v6.3 and wipes out the environment variables.
1) Is there a way to keep the current configuration of the beanstalk environment without having to deploy the .ebextensions files every time?
2) If I must deploy the .ebextensions files every time, what is the best approach for sensitive data like passwords?
Side note
I have another app in a different beanstalk environment that I deploy docker containers to. In that instance, the beanstalk environment doesn't get nuked every time I deploy a new container update. I do not send the .ebxtensions files with this deployment either.

Related

Upadate Elastic Beanstalk environment and ebextensions files

I have an elastic beanstalk environment that the first upload I used with ebextensions to configure all the configurations.
Now, If I want to update the environment again (only change the code) the ebextensions stay the same,
I need to insert the ebextensions into the zip file that I upload to update the beanstalk environment?
Or I can ignore the ebextensions and upload the zip as is?
I create the zip file using Visual Studio and I put the ebextensions inside the code.
Thanks
It depends on what is in your .ebextensions. For example, if you just install some rpm packages, then they will still be installed. But generally you would always include the config files anyway, as EB can deploy your application to new instances and then entire configuration has to be re-done from scratch.

How AWS EB works for each deployment?

I have a project in EB linked with codePipline from Github, and I have some files inside my project in .ebextensions & .platform folders
My question is: Does AWS Elastic Beanstalk deploy these files each time I deploy a new version to EB or just one time?
How EB worked behind the sense!?
the .ebextensions and .platform folders need to be part of your application code. So if you're using the CodePipeline Elastic Beanstalk deployment task, the input artefact needs to have these folders. This also allows to include these files in your versioning system.
How EB deploys new servers, depends on how you have configured it to deploy the application. You can find more information in the EB development guide.

Elastic Beanstalk Always Updates Environment On Deploy From Codebuild

I have a large, multi-component django application I am trying to deploy to elastic beanstalk. I am using the multi-docker environment. THis is my current workflow
Git commit triggers AWS code pipeline
AWS Codebuild builds docker image (docker-compose build), runs some tests, and pushes this image to AWS Elastic Container Registry
AWS Code Build calls eb deploy
The issue I am running into is that when I call eb deploy from my local box, the it simply upgrades the application, but when I call it from Code Build, it is upgrading the environment every time, which takes about 30 minutes for some reason
I run the deploy command with -v and confirmed that the same files are being zipped. Any ideas on what is going on here, is my setup incorrect?
I also tried to deploy the application from Code Deploy in the pipeline and can confirm that it also always upgrades the entire environement.
I think that if you use CB to update your EB env, it just replaces it as it is being considered as a new environment. In your local workstation you are using only one single environment, but with new application version.
I would consider replacing CB for updating your EB environment, with the EB deploy provider in your CP. This should successful just upload your new application version to an existing EB environment.
CP natively supports a number of deploy action providers, one of the being Elastic Beanstalk:
You can configure CodePipeline to use Elastic Beanstalk to deploy your code. You can create the Elastic Beanstalk application and environment to use in a deploy action in a stage either before you create the pipeline or when you use the Create Pipeline wizard.

AWS .ebextension scripts not executing

I have a powershell script in the .ebextensions folder but its not executing. It used to work but suddenly has stopped working and there have been no changes to elastic beanstalk or the scripts that i know off. I have two instance running under elastic beanstalk and if I log into one and then deploy my package it doesnt take the instance down. I can literally watch the service (IIS Rest service) files being updated.
Elastic Beanstalk is configured for autoscaling min 2 instances max 4. I've tried doing a deploy though the AWS Elastic Beanstalk console but no joy.
Does it need to actually take the instances down in order to run the scripts? I find it odd that it can update the service without stopping the instance.
Also do .ebextension scripts not execute against running instances? is there a way to force it to execute?
What else can I check to see why the ebextensions are not being picked up?
Thanks
It's working now. My ebextensions script was not formatted properly, i.e. didn't have the necessary indentations that YAML requires so the commands where being ignored. However no error was raised by EB.
Another problem is that eb cli uses git to bundle your app, which means that you need to perform a commit so that all changes are properly bundled.
Until I get my changes right, I keep doing git add & git commit --amend all the time...

Updating/Patching files inside .war in AWS Elastic BeanStalk

I Have deployed my .war in AWS Elastic Beanstalk under AWS FreeTier. Application is deployed and running fine. Now if if change any file, I have o deploy the whole .war again. Is there a way to modify/patch any files (xml,js)
inside the deployed .war in AWS?
Basically no.
You can manually access the beanstalk instances running your .war and tweak them but these changes won't persist if the machine terminates and another one is brought in her place (which is a very likely scenario)
The proper way to do it is to deploy a new application version every time you change something in your code, you can build a CI pipeline to do that for you and save most of the headache.