Deploy webapp to AWS Elastic Beanstalk using Jenkins Pipeline - amazon-web-services

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

Related

elastic beanstalk cli publishing .net core 5 webapi to existing Linux Environment - Multi-proj in one solution

I'm trying to deploy .net core 5 application to Elastic Beanstalk.
I can deploy application via AWS Toolkit. But I'm trying to deploy via EB CLI. Because github actions works with EB CLI.
So when I'm trying command eb deploy, solution create artifact with solution root directory. How can I point to eb deploy command pick up KKWebApi project, not solution.
Many Thanks.

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.

Rerun elastic beanstalk ebextensions script from aws cli

I currently have an elastic beanstalk application using ebextensions.
It works great when the application is deployed for the first time but I want to be able to run the ebextension scripts again without redeploying.
I attempted to re-run the ebextension scripts from the aws cli.
Neither
aws elasticbeanstalk restart-app-server
aws elasticbeanstalk update-environment
seem to re-run the ebextensions scripts.
The files under .ebextensions are not retained after the deployment, so you'll need to redeploy to run them again. That being said, if you need the functionality outside of the deployment activity, you might want to implement it in another way.

how to deploy code form bitbucket to amaozn EC2 server

I have created a laravel application and now i have push my code to a staging server.
In my amazon AWS account I have created an EC2 server, simple way to do this, and find it confusing.
I want to run this project on server.
Can someone please point me in the right direction?
You can use startup script on your EC2.
Your startup script should do the following steps:
1-Install requirement software or services in the new machine.
2-Download or clone latest your app code from git and build it if necessary.
3-Download other assets or software or data from the S3 bucket.(Java, Tomcat, or WARs)
4-Start and configure services.
You should strongly consider using the AWS CodeDeploy service to manage the deployment of code on your instance.
It is easy to setup, and the service itself is free; you pay for instance usage only.

AWS CodeDeploy?

My app is created using elastic-beanstalk aws service, do I need to use the AWS CodeDeploy service to deploy my app?
Currently I just do:
eb deploy myApp
Then, a new application version is deployed without using AWS CodeDeploy.
So, AM I doing something wrong?
Elastic beanstalk do it on your behalf. During deployment process you define some polices and roles, which defines elastic beanstalk will call these services on your behalf. Codedeploy is one of that services.
Elasticbeanstalk does automation of your process only and setup thet whole deployment environment for you (php,nginx/apache in case of web), if you look /opt/elasticbeanstalk/, you can see codedeploy folder there, which means that you do not need to do it manually.
AWS code deploy is different workaround and provides more controlling. How you want your changes to be pushed, is it to be pushed on all instances an once or one by one, minimum number of healthy instances.
Check here-
http://cloudacademy.com/blog/how-to-deploy-application-code-from-s3-using-aws-codedeploy/
http://blog.powerupcloud.com/2016/03/24/deployment-automation-using-aws-code-depoly/
https://blogs.aws.amazon.com/application-management/post/Tx33XKAKURCCW83/Automatically-Deploy-from-GitHub-Using-AWS-CodeDeploy
You can update the your application with new version. CLI as follows
$eb deploy --version
You are not doing anything wrong. EB Deploy will enable you to deploy your apps being served from Elastic Beanstalk. AWS Code Deploy on the other hand is more flexible & gives you more control, you can for example, deploy apps you are serving from EC2 thats not being managed by Elastic Beanstalk.
With AWS you can for example deploy to multiple environments ie development, staging, production.
Elastic Beanstalk and CodeDeploy are totally different AWS services and independent of each other and follow different deployment approaches.
What you're doing is totally correct to deploy a new version of your code.
AWS elastic-bean-stalk itself has the nice capability for deploying applications nicely.You dont need to use aws code deploy again.It will be superflous.You can use beanstalk tools itself to deploy the code.
AWS CodeDeploy is a building block service focused on helping developers deploy and update software on any instance, including Amazon EC2 instances and instances running on-premises.
AWS Elastic Beanstalk (as well as AWS OpsWorks btw) are end-to-end application management solutions.
When it comes to deploying new software release on Beanstalk, you better use the own deployment process provided to you by Beanstalk.
eb deploy myApp