Upadate Elastic Beanstalk environment and ebextensions files - amazon-web-services

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.

Related

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.

How to upload application code to AWS Beanstalk

I have a pre-built jar that I can deploy on an ec2-instance and it runs reading from a queue and processing some business logic. I want to use it with AWS Beanstalk but when I try to do that Beanstalk asks for application source code in a zip format. Does this mean that I have to provide the code of just my application? but there are a lot of jars that my application jar depends on and does this mean I must package the source code of those jars also with my application jar? Anyway I can just upload my application compiled jar
There are two options for deployment to beanstalk.
you create a zip file of your application and upload it via the console
you use the eb-cli (from the command line) to create the zip file and do the deployment
Here is the documentation for java applications: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html
And the documentation for the eb-cli:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html
After setting up the cli environment (getting ssh keys etc) you can deploy with eb deploy
About uploading code to AWS Beanstalk it can be done through beanstalk console.
Having lot of jar file for application, you need to combine all the files in single source bundle and then need to upload.
Below link gives example of
Bundling Multiple WAR Files for Tomcat Environments

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.

Boto3 Deploy to Elastic-beanstalk not reading Config files

I am using boto3 to deploy my environment to elastic beanstalk using the create_environment function. I have my configuration files in the .elasticbeanstalk folder but the deploy doesn't seem to be using them. When I deploy the same environment using the eb client it works exactly as wanted. Any suggestions?
I figured this out.
boto3 uses the aws api, which does not read the configuration files but rather reads a json configuration option (called option_settings). These allow you to configure all of your post-ec2-deploy settings (Everything you can change from the elastic beanstalk configuration page).
However, if you want to adjust configuration for what your ec2 instance has installed before your application runs (things like package installs, file creation, etc.) then you will have to create an aws image of a ec2 instance you like, and then reference that image id from the option_settings.
obviously the eb client does all of the above for you by reading the configuration files.

How can I copy a config file to an AWS EB deployment?

I have set up a Node.js / express app and I am using aws eb to deploy.
That is how my config is set up to be environment specific. However, I don't want to put my config.prod.json in my source control. How can I get that put up to my deployed application?
You can use .ebextensions folder to add some commands to copy additional files from anywhere. More info:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html