How to download website files and db from an amazon EC2 instance? - linux

I have a website that is hosted on amazon's EC2 service, and I need to download all the website files and database(s) locally. How can I do this? Also I don't have an S3 storage with amazon, everything is in a EC2 instance.

First export the database to a file. How you accomplish this will depend entirely on what database engine you are using.
You can optionally bundle everything up using a tar command.
Then connect to the server with an SFTP client and download everything.

Related

How to deploy Node.js Express server + Vue.js app on AWS EC2

I'm setting up my website which would run on an AWS Ubuntu EC2. It is a Vue.js SPA relying on a Nodejs Express app with API calls and socket.io. So far both apps are working, the backend is on my AWS EC2 free tier, behind an Elastic Load Balancer, the frontend is on my machine since I working on it. Now I would like to deploy the frontend to my AWS EC2 also but I'm confused how to do it correctly. The tutorials I've found are using nginx but I'm not sure that I need nginx as I already have AWS ELB. Any advices would be great :)
as is says "If you are developing your frontend app separately from your backend - i.e. your backend exposes an API for your frontend to talk to, then your frontend is essentially a purely static app" here
I would choose s3 to host vue app because it's static and can be served using s3 and
I will choose EC2 for hosting my API (server code) and also i'd make an elastic IP to talk to my ec2 server so that on restart i don't have to handle the dynamic IP's
Steps to make your website live
First pull yout node express server on your ec2 instance
start your node express server use pm2 to serve it as an service
expose the served port from security groups of the ec2 instance
make an s3 bucket on aws and upload files to it
Tip: just click upload button after dropping your files to s3 do not go clicking next
after uploading select all the uploaded files and then mark as public
after uploading go to properties of that bucket and then choose static web hosting and type index.html the asked field
** TIP: do not use a load balancer for this application use only when you distribute your system across multiple ec2's**

Project in S3 bucket doesn't connect to node server in EC2 instance

AWS newbie here. I have a web app where the Angular dist package is hosted in an S3 bucket, and the backend is being served on an EC2 instance. I've been following this tutorial, but after completion my project in the S3 bucket still does not connect to my remote node server.
What I understood from that tutorial was that by setting up a CloudFront distribution, it will connect the S3 bucket with the EC2 instance. But if I navigate to the CloudFront domain, it loads the S3 bucket contents but still does not connect to my node server.
When I run the node server locally, it connects successfully and I'm able to read and write to my remote Mongo database. This indicates that:
1) the connection to the remote MongoDB is successful, and
2) the front end (in the S3 bucket) is looking for a local node server instead of the remote one (in the EC2 bucket).
So my question is how do I make it so that my services make calls to the remote server instead?
Firstly S3 only hosts static content. So all your Angular dist files will sit on S3. S3 does not connect to your backend. Your browser will try to make AJAX rest calls to your Node Server.
Second your backend Node server needs to expose its Rest services via an API gateway. Thats the recommended approach. It seems if your app is trying to connect locally because of config error. You need to use the API gateway link in your Angular app.
For a quick test you could expose the port in the Security Group of your EC2 and use the public IP of your EC2 to access the node app before going about setting up API gateway.

How to access files deployed in aws elasticbeanstalk

I have deployed node.js code on aws elasticbeanstalk creating a new environment. The app is successfully deployed. I want to access the files. I used ssh to the remote machine but the I can't find the code
Elastic Beanstalk places the deployed code in /var/app/current
Note that you shouldn't be making changes on the Elastic Beanstalk server directly.
Adding to the last answer, remember that you need to select enable SSH to your instances when launching application. Else, you won't be able to SSH into any AWS Elastic Beanstalk instance.
If you found this question but you're not using ssh, you could download the zip after clicking on a version in the console.

How to serve my content with nodejs vm on google cloud

I created a nodejs virtual machine instance on google cloud (compute engine). I also created 3 mongodb instances on the compute engine. Now I pushed my local application to the google cloud repository. How do I link the app.js file to this server so it starts running the script and serving the files. I already changed the A record of my domain that I registered with godaddy so it's external ip is the same as that of the nodejs server I am running but all I am getting is this page.
Bitnami developer here.
You need to copy your files to the remote repository, create the configuration files and after that you have to include that configuration in the configuration of Apache to serve the application. It looks like you have done most of the work, but there may be an error in one of the steps. This guide will help you to configure your application in order to access it properly.
https://wiki.bitnami.com/Applications/Bitnami_Custom_Node.js_Application
I hope it helps.
Jota

Amazon EC2 IIS-8 User's Permission Write Access

I am using Amazon EC2 using Elastic Beanstalk deployment process through Visual Studio all is working well, except that when the application is deployed it does not have by default write permission; so I had to manually Remote Desktop the individual machine; and give it write permission through IIS site and under permissions.
How can I automate this process, since amazon servers adds on to load balancer using auto-scaling etc.?
Or If I change one, the other to follow will copy the exact same thing, which I had done manually?
I am little confused, first time deploying, please help?
Thanks
Yes, you can use ebextensions config to set permissions on the directory after the instance spins up. Here is an example of someone creating a directory and setting the permissions on the new directory, you should be able to adapt to your circumstances:
AWS Beanstalk ebextensions on windows

Resources