Amazon EC2: Guide to Deploying Your First Server

In this blog, we gonna continue our previous blog in which we connected to our EC2 instance from our Windows machine and now we will continue from there and if you feel what we are talking about then you can refer to that blog.

So I hope you have your secret key pair which we got at the time of instance creation.

Connect to your EC2 instance.

If you read our blog we did this thing in that also you just need to keep your key in the project folder and open that specific folder in git bash or WSL and follow the commands.

$ ssh -i {key-pair}.pem ubuntu@{private-ip}

Now we have to clone our server in that machine and install a node in that machine.

If you don't know how to install node in the Linux machine you can figure it by simple search or you can follow this page.

git clone https://github.com/Vishal2002/Photo_Gallery

Now as we do the things similar in our pc for setting up project run it we will do the same things here.

After cloning we will install the node_modules after getting to the server folder.

npm install

Now if you are in the journey with us then you know that this is the project photo gallery with the help of S3 and this requires a .env file to setup our server and if you don't have the env variables then also let me tell you how to make a file and write in it in terminal using nano editor.

nano .env

this will open an empty vim type editor and the above command will open .env file if exists in the folder and if no then it will make a new .env file and open it.

After setting the correct environment variable or pasting them from our previous tutorial you can just follow this to close the file by saving it.

CTRL+O then One Enter and CTRL+X

Now as we are good to go before that we have to see the security groups?

Security groups function similarly to firewalls by establishing rules that dictate which traffic is permitted. Only traffic that aligns with the rules defined in the security group is allowed.

Setting up Security Groups in EC2.

  1. Go to the security Tabs in the specific instance.

  1. Edit the inbound rules by clicking on the edit button.

Now we are all set just run the server from the terminal and hit the public ip of your instance.

I hope you found valuable insights on setting up security groups and deploying servers on EC2 through this blog. Remember, robust security measures, such as carefully crafted security groups, are crucial for safeguarding your infrastructure in the cloud. By leveraging the flexibility of EC2, you can efficiently create, deploy, and scale your server applications. Stay tuned for more informative content and practical tips on optimizing your AWS experience!

Share this blog with your friends and teammates to spread knowledge and empower each other in mastering AWS and cloud technologies. Together, let's dive deeper into the world of cloud computing and continue building amazing projects. Happy coding!

Did you find this article valuable?

Support Vishal Sharma by becoming a sponsor. Any amount is appreciated!