steps 1) log in to AWS Console
step 2) select region o top right corner ( place and select mumbai region )
step 3) click on services on top left corner and select EC2
step 4) you will be redirected to instance page and it shows already running instances ....and click on lanunch instance to create new instance
step 5) after clicking launch instance then select Amazon Machine Image ( which is OS type) and also click Free tier on left side
step 6) select 64 bit ubauntu machine , then select t2.micro which is free tier and also shown in green color
step 7) click on review and launch
step 8) then choose either existing key or new key , then give key pair name and then download file.
step 9) click on launch button to launch instance
step 10) go to instance page then click on instance and then click on connect button then select ssh client
step 11) run following command in downloads terminal
chmod 400 keypairname (oly for first time)
step 12) then copy ssh command to connect to instance from local system
****************** above steps are to create instance & to connect to instance *************
procedure to install node js in virtual server
step1) visit the following link to go through guide for installing node js
https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html (do almost all commands & this install is done through NVM)
step 2) install mariadb with the following link
https://yottabrain.org/database/mysql/install-mariadb-in-aws-ec2/ (oly first two commands)
then as ther will be no intiall password set so type this command sudo mysql -u root to login and create a user and grant all previlages
commands to create user & give privilages
1) CREATE USER 'username'@loaclhost IDENTIFIED BY 'password'
2) GRANT ALL PRIVILEGES ON *.* TO 'username'@localhost IDENTIFIED BY 'password';
3) FLUSH PRIVILEGES
then create database and import database in ec2 instance
************ above are steps to install nodejs and mariadb in ec2 instances ************
Steps to move files from local system to ec2
scp -i ./awsin2.pem ./awsdb.sql/ ubuntu@ec2-13-235-114-62.ap-south-1.compute.amazonaws.com:
awsin2.pem - this is key file
awsdb.sql - this can be any file , you want to push
ubuntu@ec2-13-235-114-62.ap-south-1.compute.amazonaws.com:- this is instance address
any file you want to psuh should be copied in downloads file i.e location of pem file
Next steps
import database then clone git hub code & make some changes in .env and config file
then check server running by cmd node server.js ,,,,, if every thing is good , then we have to make run port 8000 for ever....
installing PM2 for continous running server
1)npm install pm2 -g
2) then start server by following command
pm2 start server.js
>> then final step is install nginx and configuring it.....
Comments
Post a Comment