Elastic Beanstalk deployment in AWS by uploading zip (after downloading it from EB) - amazon-web-services

I'm learning Elastic Beanstalk. We have an application which is deployed with EB.
I'm able to download the zip of the deployment.
Now is my question: am I able to adapt the content of the zip and recreate the zip and deploy again? Because this does not seem to work for me:
Infra-WriteRuntimeConfig, Infra-WriteApplication1, Infra-WriteApplication2, Infra-EmbeddedPreBuild, Hook-PreAppDeploy, Hook-EnactAppDeploy, Infra-EmbeddedPostBuild, Hook-PostAppDeploy ..
The application (which I don't know) is also in a git. Is the zipfile on AWS the application after the build + deploy so is the approach I'm taking not possible? Am I trying to redeploy an already build application which includes changes?
In the logs I see some: AWSDeployment.log. Is this part changing the content which is in the zip on AWS?

Related

Deploy app to AWS Elastic Beanstalk using docker-compose

I'm trying to deploy a multi-container app to AWS Elastic Beanstalk using docker-compose. My folder structure is as follows:
AppDirectory/
app/
proxy/
scripts/
static/
docker-compose.yml
Dockerfile
requirements.txt
I've got the images built and pushed into Docker Hub. Also, the environment is working as expected when running docker-compose up in development. Using AWS Elastic Beanstalk dashboard, I create an application and then I proceed to create an environment, using Docker as platform. I have a .zip folder with the structure mentioned before.
When creating the environment, there's first a console log telling me that Configuration files cannot be extracted from the application version appname-source. Check that the application version is a valid zip or war file.
Not sure what it means here, as I'm uploading a .zip file and inside there are Dockerfile and docker-compose.yml.
After it says the app deployed successfully, I get a 502 Bad Gateway error from nginx and then I have the environment with severe health and updating for hours without changes. I've been following the documentation regarding this and I believe it is possible to deploy it with docker-compose.yml, however I'm wondering if my configuration is enough? I linked the Docker Hub images also inside my docker-compose. I'm not able to request logs neither as the state must be 'ready', and it is constantly 'updating'.
Anyone with any experience with such deployment that wants to share any tips or configuration settings? Thank you.

Can JARs be uploaded successfully to AWS Elastic Beanstalk from the AWS web UI?

I'm trying to build a basic Spring Boot Java web app and deploy it to AWS Elastic Beanstalk (EB). Most tutorials I've read suggest uploading a JAR when creating an application, however, I'm unable to successfully deploy a JAR using the AWS web UI. When I try, the state of the environment is set as 'Severe' and the environment web link returns a 502 Bad Gateway response.
In order to make sure it wasn't some issue with the code, I downloaded the Java sample app from AWS (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/samples/corretto.zip), fixed the jetty inconsistency in the pom.xml file (the plugin didn't match the dependency), set the JDK version to be the same as what I created the environment to be (Corretto 11), then ran the following command to create the JAR:
mvn package
When I upload the created JAR onto the EB environment, the deployment fails. If, however, I simply upload the downloaded zip file (with the corrected pom and correct JDK set), the deployment works.
The following AWS page talks about how to create a source bundle to upload and only mentions being able to upload ZIP and WAR files, not JARs:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.html
My question is then, is it possible to upload JAR files to Elastic Beanstalk via the EB web UI, or do I need to stick with WAR and ZIP files? This will help me when navigating the various Spring Boot / Elastic Beanstalk tutorials out there. It's proving quite difficult to get any Spring Boot web app to actually work on Elastic Beanstalk. Any advice would be much appreciated.
It is very possible to upload a JAR to Elastic Beanstalk using the AWS Management Console. Furthermore, then once deployed, the app shows Green:
If you get RED, means you have not set something correctly.
See this basic Spring BOOT app example to follow this process.
Creating your first AWS Java web application

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

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.