how to deploy code form bitbucket to amaozn EC2 server - amazon-web-services

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.

Related

How to deploy from Cloud9 to EC2?

I have my app developed in Cloud9, and I would like to use the terminal with GIT commands to deploy my app to a EC2 instance. The objective is to make the app run in the EC2 instance.
Is it necessary to deploy the app to a EC2 instance, or is it already in a EC2 instance and I just have to open the URL of the app?
My cloud9 environment is in a region and my EC2 Instance is in another region (I'm telling this just in case it changes something in the process).
I already did it to Heroku, but I can't see how does it work to a EC2 instance.
Thank you very much !
If you want to deploy your app to an EC2 instance from the Cloud9 console, you have a couple of options. Please note, you only need to use one of these options, not all of them. I would generally recommend option #1 for your case based on your original question.
Use AWS amplify instead of EC2 (Amplify is Amazon's version of Heroku)
Use the AWS CDK client, and specifically, you'll want to look at Instance and either utilize userData or CodeBuild to build your app and deploy to EC2.
Use the AWS client to deploy Cloudformation templates (this is the lower-level version of option #2 and will require more boilerplate)
Connect your Git repository to AWS CodePipeline and run a CI/CD flow to deploy it to EC2 on every commit to the main/master branch (this is fairly complicated)
The most important thing to understand is that Cloud9 is simply an IDE (integrated development environment) that is deployed to an EC2 instance that is managed by AWS (not you). Cloud9 is not a tool for actually deploying code (you'll need to use one of the options I mentioned above for that).

AWS How to deploy my internet site created with Typescript on AWS

I have create a website using VS Code in NodeJS with typescript language.
Now I want to try to deploy it on AWS. I read so many things about EC2 , Cloud9 , Elastic Beanstalk, etc...
So I'm totally lost about what to use to deploy my website.
Honestly I'm a programmer, not a site manager or sysops.
Right Now I create an EC2 instances. One with a Key name and One with no key Name.
In the Elastic Beanstalk, I have a button Upload and Deploy.
Can someone send me the way to create my project as a valid package to upload and deploy it ?
I never deploy a website. (Normally it was the sysops at the job). So I don't know what to do to have a correct distributing package.
Does I need to create both EC2 and Beanstalk ?
Thanks
If you go with ElasticBeanstalk, it will take care of creating the EC2 instances for your.
It actually takes care of creating EC2 instance, DB, loadbalancers, CloudWatch trails and many more. This is pretty much what it does, bundles multiple AWS services and offers on panel of administration.
To get started with EB you should install the eb cli.
Then you should:
go to your directory and run eb init application-name. You'll start a wizard from eb cli asking you in which region you want to deploy, what kind of db and so on
after that your need to run eb create envname to create a new env for your newly create application.
at this point you should head to the EB aws panel and configure the start command for your app, it usually is something like this npm run prod
because you're using TS there are a few steps you need to do before being able to deploy. You should run npm run build, or whatever command you have for transpiling from TS to JS. You'll be deploying compiled scripts and not your source code.
now you are ready to deploy, you can run eb deploy, as this is your only env it should work, when you have multiple envs you can do eb deploy envname. For getting a list of all envs you can run eb list
There are quite a few steps to take care before deploying and any of them can cause multiple issues.
If your website contains only static pages you can use Amazon S3 to deploy your website.
You can put your build files in S3 bucket directly and enable static web hosting.
This will allow anyone to access your website from a url globally, for this you have to make your bucket public also.
Instead you can also use cloudfront here to keep your bucket private but allowing access to bucket through cloudfront url.
You can refer to below links for hosting website through s3.
https://docs.aws.amazon.com/AmazonS3/latest/user-guide/static-website-hosting.html
https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/

AWS: How do I continuously deploy a static website on AWS

I have a github repo with static website contents (i.e I try not to use EC2, but the AWS static website service). Now I want to automatically deploy it on AWS anytime I change and push something to the master branch of my github repo.
Any experience or idea doing this?
I do this for many projects by using a Jenkins server - I happen to run it on another ec2 instance, but you could also run it on-premise if you prefer.
Github notifies Jenkins server that a checkin has occurred, and a Jenkins job deploys all the files to the proper places and also notifies me by SMS (or email), that a deployment has occurred.
(Jenkins is not the only tool that can do this there are others).

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.

How do i automatically deploy a mean stack application on to AWS server?

I have a mean stack application running on an AWS instance, but whenever there is a commit, we have to manually deploy the code by using putty and winSCP,
Is there a way to detect changes in the Bitbucket(we use BB as it has private repos) repository and automatically push the changes to the AWS instance?
i heard gulp can do the task , but i doubt it can push code to the instance.
can someone please help me out?
You could move your application to Elastic Beanstalk. You could use Amazon Code Deploy (although I don't think it works with Bitbucket yet). You could setup a Jenkins server that would do this for you. You could use Gulp to do this, or countless other similar tools. There are also services like DeployHQ and Codeship that will do this for you.