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

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

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.

Deploy webapp to AWS Elastic Beanstalk using Jenkins Pipeline

I've manually deployed my web application to AWS EBS. We use to normally have a jenkins pipeline which deployed the app to tomcat server running on AWS using mvn tomcat8:redeploy-only -Ddeploy.address=xx.xx.xx.xx:port
How do you deploy to AWS EBS with Jenkins, at the moment I'm having to upload the war file each time we have an update.
Any help is much appreciated.
Thanks
I haven't tried, but there is a Jenkins plugin for Elastic Beanstalk.
Alternatively, you could install elb cli in your Jenkins nodes to manage your environments.
I used AWS Beanstalk publisher jenkins plugin which allowed me to set up post-build actions which was the answer. You need to specify S3 bucket in the settings of where your app will be deployed to and set up version labelling. Thanks for kgiannakakis for referring this to me.
A good video I used can be found here: deploy war file to aws ebs

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 code deploy to deploy

Right now I am manually deploying WAR files onto wildfly server(which is hosted on an ec2 instance) but I want to automate this and get rid of the manual deployments.
I build the application using jenkins (from another EC2 instance) and after that i want to deploy to the wildfly server and since i am also planning to user codepipeline, can anyone please tell me how to deploy an applcation on wildfly server using AWS CodeDeploy?
I am new to codedeploy so not that familiar with its usage.
Thank you,
Ajit
Hi #Ajith Code Deploy is the perfect tool for deploying applications in AWS. But it has some limitations, for example to give a source repository for the Code Build/ Code Deploy you can only choose these 3 as the code repository.
AWS Code Commit
AWS S3 Bucket
Guthub
You cant provide your own custom repository or Bitbucket. Please go through the below Examples for deploying applications using Code Deploy. I can't explain all the steps because it have a lot of steps. here they are explaining app deployment using tomcat, replace this with your wildfly scripts.
Deploy Applications From S3 using Code Deploy.

Elastic Beanstalk deployment in AWS by uploading zip (after downloading it from EB)

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?