Updating/Patching files inside .war in AWS Elastic BeanStalk - amazon-web-services

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.

Related

AWS beanstalk deployments wipe out environment variables

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.

Why application works in AWS ElasticBeanStalk, after deleting war file from BeanStalk?

After deleting war file from BeanStalk, application still works in AWS ElasticBeanStalk.
I tried deleting war file from AWS S3, still it works.
Doesn't tomcat undeploys war file, when we delete the version from "Application Versions" of Elastic BeanStalk?
That sounds correct, deleting the version or the war file should have no impact on the copy running on the servers. You can deploy any application version to Beanstalk environments, but there is no "undeploy" command. You could remove the files directly in the instances or use Tomcat management APIs to achieve undeployments if you must.

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

How to update particular server files (or) partial deployment in amazon elastic Beanstack?

I deployed a new version in amazon elastic beanstalk with .ebextension folder. But I have only see new deployment version files in website and lost the old files which was present in old version. How to update particular server files (or) partial deployment in amazon elastic beanstalk ?
You cannot partially update deployments in Elastic Beanstalk. The application zip bundle you upload during a deployment entirely replaces the old bundle.
If you want to "partially update" files in a deployment, merge the changes on the machine from which you are deploying, then zip the merged bundle, then deploy the new application version.

How can I deploy to Elastic Beanstalk using git pull instead of uploading the whole repo

Right now I'm using eb deploy to deploy an application to Elastic Beanstalk. However the upload process is relatively slow. I was wondering if it's possible to get Elastic Beanstalk to run git pull so that it's downloading the latest set of diffs instead of uploading the entire repository each time.
This is not possible.
You could however set up a separate environment that does a git pull every so often and deploys to beanstalk if there are changes.
The upload should be fairly quick instance to instance.
My suggestion would be to setup a clean Continuous Integration process using something like CodeShip or some other SaaS Service. Usually you can do this for free and it provides nice Continuous Delivery deployments straight to Elastic Beanstalk and a lot of other services.
I have written about it recently here and here to specifically do what you're aiming to accomplish.