In this tutorial, you will learn how to launch an EC2 instance using free tier Ubuntu 18.04 server within the AWS console.
In today’s era, a Cloud server hosting is rising fast and many developers and entrepreneurs have moved their on-premise server to the Cloud service because they want to avoid spending much money on things that needed to install on the on-premise server.
Amazon Web Service named as a Leader in Gartner’s Infrastructure as a Service (IaaS) according to Gartner Magic Quadrant.
AWS Cloud infrastructure is designed and built to deliver the most flexible, reliable, scalable, and secure cloud computing environment with the highest quality global network performance available today.
Using AWS, you only pay for what you use and you don’t need to worry of the following features:
- Performance
- Availability
- Security
- Reliability
- Scalability
- Low Cost
What will you do
- Login to AWS Console
- Choose Amazon Machine Image (AMI)
- Configure EC2 Instance details
- Add Storage Size
- Add Name Tag
- Setup Security Group
- Review and Launch Instance
- SSH remote into EC2 Instance
To get started, this guide shows you through step process on how to launch new Amazon EC2 Instance using free tier Ubuntu 18.04.
For more information about Amazon EC2 Pricing and Free Tier EC2 limits
Step 1. Login to AWS Console
Log in into the AWS Console and from the main dashboard select your instance region closest to the client’s location.
Example (Asia Pacific Singapore) choose at the right upper corner.
Next, choose the Launch Instance button and you will redirected to the next screen on EC2 configuration.
Step 2. Choose Amazon Machine Image (AMI)
To launch Ubuntu 18.04 on Amazon EC2 instance, select the Ubuntu Server 18.04 from Amazon Machine Image (AMI) List.
Step 3. Choose EC2 Instance type
Select your prepared EC2 instance type that capable to manage your web application and operate on a production environment.
The following types of instances:
- General Purpose Instances – T2, T3a, M5, M4, M3.
- Computer Optimized Instances – C5, C4, C3.
- Memory Optimized Instances – X1, R4, R3.
- Accelerated Computing Instances – P3, P2, G3, F1.
- Storage Optimized Instances – I3.
- Dense Storage Instances – D2.
In this example, choose on t2.micro free tier eligible instance for General Purpose and choose Next to configure instance detail.
Step 4. Configure Amazon EC2 Instance Details
From the field Number of instances, you can choose to launch more than one instance at a time, but in this example set value only to 1 instance.
Then leave to default for the following fields and choose Next to add storage.
Note: You can configure in advance for the following configuration details when needed.
Step 5. Add Storage Size
The default Linux storage value is 8Gb, In this example, we need to resize the storage for 20GB to maximize the capacity utilization of root volumes.
Choose Next to add tag name on Amazon EC2 instance.
Step 6. Add Name Tag
A tag is an identifier or label name that allows you to categorize your AWS resources in a different of way. See an example:
Note: A copy of a tag can be applied to volumes, instances or both.
Choose Next to add a security group for your Amazon EC2 instance.
Step 7. Setup Security Group
On this page, you can add rules to allow specific traffic to reach your instance.
Examples of ports that can allow to reach your EC2 for example:
- 22 – used for Secure Shell (SSH), secure logins, file transfers (scp, sftp) and port forwarding.
- 80 – common used by web servers providing access for HTTP protocol only.
- 443 – common used by web servers providing HTTPS access protocol (HTTP encrypted by SSL or TLS certificate).
Choose Review and launch.
Step 8. Review and Launch EC2 Instance
Please check your EC2 instance launch details. You can go back to edit the changes for each section. Click Launch to assign a key pair to your EC2 instance and complete the launch process.
On this page, the popup box will appear on the screen and then you have to choose the options either using the existing key pair or creating new key pair.
A key pair consisting of a public key that allows you to securely remote SSH into your instance. However, you can use the key pair to access on multiple instances.
Now on the popup dialog box:
- Choose Create a new key pair and name the key pair as a “Development“.
- Select the Download key pair button then keep your Development.pem file.
- Choose Launch.
Now your instance are launching, it may take a few minutes until they are in Running state.
Step 9. SSH Remote To Amazon EC2 Instance
Lastly, copy your Development.pem file to your home directory (/home/ubuntu/.ssh) and set read only permission for user using the key.
Now use the following command:
mkdir ~/.ssh
cp ~/Downloads/MyProductionKey.pem /home/ubuntu/.ssh/
sudo chmod 600 ~/.ssh/MyProductionKey.pem
Open the Amazon EC2 console and check the instance status. If you see the instance in Running state. Copy the IPv4 Public IP on the clipboard.
From your client Ubuntu machine, open the terminal by pressing the shortcut key on your keyboard Ctrl+Alt+T and use the IPv4 address to SSH remote into your server, type command:
ssh -i ~/.ssh/MyProductionKey.pem ubuntu@18.233.153.80
Type Yes when ssh remote asking you a permission for the first time to connect on the instance.
It looks like this:
The authenticity of host '18.233.153.80 (18.233.153.80)' can't be established. ECDSA key fingerprint is SHA256:0TkfIOzdmkz1Iwvx5X27erluNoKSRYSbjy4S9NG/inE. Are you sure you want to continue connecting (yes/no)? yes
When you log into Amazon EC2 instance, the welcome message will appear for the first time.
That’s all.
Finally, you have successfully completed this tutorial on how to launch Amazon EC2 instance using free tier Ubuntu 18.04 server within the AWS console.
I hope this tutorial helped you and feel free to comment section below for more suggestions.
Tags: aws, ec2, linux, ubuntu, ubuntu 18.04