How can I connect an app with an aws ec2 instance

+1 vote

I'm trying to set up my node.js application on an aws ec2 instance. So far, I've set up the elastic IP, then launched an ubuntu ec2 instance, IP is connected, opened port no. 3000, and SSH'd into the server with the .pem file.

Now I'm trying to upload my files to the server. I'm using filezilla, but when set up the site on filezilla there is no /var/www folder on the remote site.

 

Also I'd like to know what steps to follow to do after I upload the files. I'm following some tutorials but they are limited to just setting up ec2.

Apr 5, 2018 in DevOps & Agile by Damon Salvatore
• 5,980 points
2,367 views

3 answers to this question.

0 votes

After connecting to the ec2 instance, clone your code on it. It's not compulsory to keep /var/www/html but still it is considered a good practice. Clone the npm install directory in your project directory. It will install all the required packages to it.

Now for running you app in production you need a service like pm2, forever etc. use one of these services, configure it and then run your app on any port you want. for eg. if you're using pm2

$ PORT=4567 pm2 start app.js --name API --env production -f

Now you can use pm2 to check its status. your app should be running on https://server-ip:4567/ . You'll have to configure the likes of apache or nginx to forward requests recieved by your app to the port you selected. After that you'll be able to access your app without the port number.

I'd say instead of doing this. move your application to a vcs like git. A lot easier to configure your application like that.

answered Apr 5, 2018 by ajs3033
• 7,300 points
0 votes

/var/www is not necessary, SSH to your EC2 and then clone your repository there.

Then cd into your repo and run npm install and then start your app.

And check.

answered Oct 18, 2018 by Hannah
• 18,520 points
0 votes

This is how you deploy a web application on ubuntu instance in AWS

  1. Create a site using ArcGIS Server Cloud Builder on Amazon Web Services.
  2. Add rules to your site's Amazon security group to allow the following:
    • SSH access (typically through port 22) for your IP address. This allows you to log in and configure your instance.
    • HTTP access (typically through port 80) for the IP range of your choosing.
  3. Using SSH, log in to the site server instance. This is the instance containing the configuration store. It is marked as SITEHOST when you view your list of instances in the AWS Management Console. Unless otherwise noted, perform the remainder of these steps while logged in to this instance.

    To log in, enter the following command:

    ssh -i <your key pair file> ubuntu@<Public DNS of your AWS instance>

  4. Start Apache using the following command:

    sudo service apache2 start

  5. Configure Apache so that it starts whenever the operating system starts. Use the following command:

    sudo update-rc.d apache2 defaults

  6. Using the AWS Management Console or another client to AWS, allocate an Elastic IP address and associate it with the site server instance in your site (remember, this is the instance to which you logged in).

    The Elastic IP address is necessary because Amazon Web Service changes the machine name whenever you stop and start a site. The Elastic IP gives you a constant address that you can use for accessing your ArcGIS Server.

  7. Deploy your web application by copying it to Apache's root folder, /var/www/.
  8. Optionally, communicate with your network administrator to register a domain name for your site.

    In most cases, you'll want to create a domain name such as mymaps.mycity.gov instead of directing users through your Elastic IP. Provide your Elastic IP address to your network administrator and he or she can associate a domain name that points traffic to your site.

  9. Update any URLs in your web application code.
    • JavaScript applications—The URLs must use your newly defined domain name.
    • Flex and Silverlight applications—Use the URLs containing the address of the Elastic Load Balancer (ELB) that Cloud Builder placed on your site. For example, http://<ELB address>/arcgis/rest/services/MyService/MapServer. Flex and Silverlight can access web services through the ELB address because client access policy files were automatically added to the site.
answered Oct 18, 2018 by Hannah
• 18,520 points

Related Questions In DevOps & Agile

0 votes
1 answer

How do I use Devops with Xamarin and hockeyapp

It would be better if you use ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by Atul
• 10,240 points
752 views
+3 votes
2 answers
+1 vote
8 answers

How can I implement process.env in Angular 5 environment?

Users do not have access to process.env ...READ MORE

answered Apr 3, 2018 in DevOps & Agile by DareDev
• 6,890 points
13,200 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,065 views
+2 votes
1 answer
0 votes
1 answer

How to set up a VM with KVM/qemu without VitualBox using Vagrant

Start the vagrant box using: vagrant up --provider=kvm But ...READ MORE

answered Apr 11, 2018 in DevOps & Agile by ajs3033
• 7,300 points
2,435 views
0 votes
1 answer

Can I run a program on release failure in TFS?

You can try and do the following ...READ MORE

answered Apr 26, 2018 in DevOps & Agile by ajs3033
• 7,300 points
856 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP