In this part, we will be creating an Amazon account, EC2 instance and connect to that instance via SSH. We will be using Linux OS throughout this tutorial. Windows users, don’t get annoyed. We will be working only on Amazon website with some terminal commands so System or OS doesn’t be a big issue here. Create an AWS account @ https://aws.amazon.com/ You will be asked to provide your card details. Don’t worry, it is just for the verification purpose. You have an option to use your AWS account in for 1 year and you will not be charged in this period. free-tier period Once you have created your account successfully, Click at the top and select Click Launch Instance or Create Instance button. You will see the below page after clicking on it. Services EC2. Step 1 — Select Ubuntu Server 16.04 LTS 1. Select Ubuntu Server 16.04 LTS. You find most of the Linux images which is used to run variety of applications and used widely. Windows images are used specifically for .NET applications. So lets stick to Linux image which has a wide user base and tons of forums and communities to address any kind of issue. 2. In Step, , select which is enough to run multiple applications and let’s not exceed our free-tier limit. Click Choose an Instance Type t2.micro Next: Configure Instance Details Step 2 — choose t2.micro 3. It is not necessary to configure any of the instance details as of now. So lets skip this step and click Next: Add Storage 4. 8 GB of an SSD is fine for us to run a normal application. So lets not change anything here and move on to next step. Click Next: Add Tags 5. Tags are used to tag your instance, specially used to filter when you have multiple instances. No changes needed as of now and click Next: Configure Security Group 6. Security Group is a config for your server. It allows you to define which port should your server allow traffic, protocol & port range etc. You can also add an description for the port you allow here. Also name your security group name meaningfully. To run our app, we need SSH access which by default is on port 22 and Amazon makes it default for us. There is also a warning sign below allow access from known IP address alone. Keep this in mind and whenever you are required to allow any port or IP, you are allowing access to your server from that address. The default port is 80 for any site but our browser tape that so that we couldn’t able to see it. So let’s open the port 80 which is by default and to serve an app we need HTTP so let’s create a rule by clicking, and select HTTP in type. Let protocol be TCP. Add 80 in port range. Select in the source so that we are opening it to all IP address. Add Rule Anywhere 7. Click button to launch your instance successfully. Review and Launch Now you will be prompted to set up an SSH key-pair which is a file, gives you access to connect it to your instance(we just created) from your Linux terminal. Give a proper name (I will name it as ), download it and keep it safe or else you will need to generate a new one if you lose. pem AWS-EC2-INSTANCE-LIVE Click and Click . Launch Instances View Instances Hurray! You have created your remote server successfully. Check the below image and find your running instance details below. EC2 Running Instance Optional — You can also move your file to default folder in your MacOS. Open Finder and press type in the search box and click to get into ssh key folder. It is recommended to put your file in this folder, which is hidden by default. .pem .ssh Cmd+Shift+G ~/.ssh Go .pem : Always remember to stop your instance when you are not using it by Note RightClick on instance -> Instance State -> Stop Now let’s connect to our instance from our terminal. Use to set permissions to your .pem file so that it can be used as a key to connect to our instance. chmod $ chmod 400 ~/.ssh/AWS-EC2-INSTANCE-LIVE.pem To SSH into our server, we need three parameters. Username Domain Address Pem file You don’t need to worry about searching for these params. AWS has formed this query string with your instance details already. Click Connect. Click the option in the aforementioned page. You will see a popup like below. Connect Copy highlighted query string. Copy paste the highlighted query string, give your file location and press enter in your terminal. Type when prompted so that you can add your instance as your known host (One time process). .pem Yes My final query string goes below. $ ssh -i ~/.ssh/AWS-EC2-INSTANCE-LIVE.pem ubuntu@ec2-xx-xxx-xx-xx.us-east-2.compute.amazonaws.com : I have file in default .ssh folder here for security reasons. Anyone having this file can access your instance. Keep it safe Note .pem .pem Yes. You are connected to your remote server securely. In the next tutorial, let’s install and configure Nginx on this remote server and deploy the Node.js app in production. If you have already bought a domain name, let’s map it too ;) Thank you.