Home > OS >  How to deploy from Cloud9 to EC2?
How to deploy from Cloud9 to EC2?

Time:07-12

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 !

CodePudding user response:

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.

  1. Use AWS amplify instead of EC2 (Amplify is Amazon's version of Heroku)
  2. 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.
  3. Use the AWS client to deploy Cloudformation templates (this is the lower-level version of option #2 and will require more boilerplate)
  4. 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).

  • Related