Hosting web servers on the internet can be very challenging for a first-timer without a proper guide.
Cloud service providers have provided numerous ways to easily spin up servers of any kind in the cloud.
AWS is one of the biggest and most reliable cloud-based options for deploying servers.
Here’s how you could get your Linux-based server running in the cloud with AWS EC2.
What Is Amazon EC2?
Amazon Elastic Cloud Compute (EC2) is one of the most popular web services offered by Amazon.
This is very useful for launching secure web servers and making them available on the internet.
Heres a step-by-step guide to launching a Linux-based EC2 instance on AWS.
Youll also learn how to connect to it securely via the console.
Sign in to your existing AWS account or head over toportal.aws.amazon.comto sign up for a new one.
Then, search and navigate to theEC2dashboard.
Locate theLaunch instancesbutton in the top-right corner of the screen and click it to launch the EC2 launch wizard.
You’re free to explore otherrecommended Linux server operating systemsother than Ubuntu.
For demonstration, we’ll go with the default (t2.micro) instance punch in.
you could either use an existing key pair or create a new one.
TheNetwork settingsfor your EC2 instance come up next.
better to restrict SSH connection to only your IP address to reduce the chances of yourserver getting hacked.
You should also allow HTTP traffic if you’ve created the instance to be a web server.
Storage options
By default, EC2 will allocate storage based on the instance pop in selected.
You will be redirected to a screen where you have theView Instancesbutton.
Click it to see your newly launched instance.
It could be an Apache server, Node.js server, or whatever server you want to use.
To connect to your Linux instance via EC2 instance connect, select it on the dashboard and clickConnect.
Select theEC2 instance connecttab and punch theConnectbutton.
This would automatically open up a screen that looks like a command-line interface.
You should see the Apache demo page.
Congratulations on successfully setting up your Linux server in the AWS cloud.
You may now build and deploy your applications to production with it.