Cannot deploy my monorepo API folder to aws Elastic Beanstalk - amazon-web-services

I am trying to set up a monorepo with a react frontend in a client folder, and an express backend in an api folder.
I have successfully deployed the frontend to aws amplify, but I cannot deploy my backend using aws elastic beanstalk and aws codepipeline.
I am getting the following error message in aws Elastic Beanstalk: "Instance deployment failed to generate a 'Procfile' for Node.js. Provide one of these files: 'package.json', 'server.js', or 'app.js'. The deployment failed."
I know the error message is obvious, but I cannot find anywhere that specifies what I should set in my procfile, package.json or so on, in my root folder so that Elastic Beanstalk can target my api folder. More specifically the path "/api/server.js"
I have looked high and low for a solution but nothing seems to work...
Has anyone had this issue before and could perhaps help? I've been trying to solve this for 9 days now... :'(
Really appreciate any help on this!

Related

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

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

AWS Elastic-Beanstalk: ECS task stopped due to: Task failed to start. (nginx-proxy: php-app: )

I'm trying to move my Laravel website to Elastic beanstalk using this github script:
https://github.com/peec/laravel-aws
Everything should work out of the box, including RDS db, SQS for queues, elastic cache etc..
I did as requested, but, from some reason, I have this error (even though I have nothing on my website folder, Just make elastic beanstalk work with the docker):
Any idea how can I make it run? or, how should I remove the errors above?
you can find the "Dockerrun.aws.json" file on the github library above, didnt change anything except the AWS Keys on the .ebextensions -> options.config
Thank you!
Eran.

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.

Deploying failed in AWS Elasticbeanstalk

I have a problem in deploying PHP based web application in AWS EB. I tried to push files using GIT bash; it went fine and shows completed 100%.
Then I checked in my AWS console it shows "Environment update is starting." after few seconds it shows
"Service:AmazonCloudFormation, Message:Stack:arn:aws:cloudformation:us-east-1:556003586595:stack/awseb-e-m3tbtwpcpe-stack/0bb57070-5fac-11e2-af2e-5081b23f0c86 is in UPDATE_ROLLBACK_FAILED state and can not be updated."
"Failed to deploy application."
Please help someone how to resolve this issue. I am in urgency of setting the web application in AWS EB as soon as possible.
Thanks in advance,
Sankar.
Have you tried rebuilding the environment from the AWS Console? Are you doing anything less common like running your Beanstalk environment inside of a VPC?