Introduction
In this article, an Amazon EC2 (Elastic Compute Cloud) instance will be created using the Amazon Linux 2023 AMI operating system image, the root user will be configured to access the remote virtual server via SSH, and a free tier usage alert will be configured.
Prerequisites
Before you start, you need to install and configure the tools below to access the remote server.
- AWS Account: Amazon Web Services is a cloud computing services platform and it will be used to create the Amazon EC2 instance.
- SSH Client: Secure Shell is a protocol for sending commands securely to a remote server and it will be used to access the virtual server.
- Terminal: Terminal is the visual interface where the user types commands and views results by interacting with the operating system programs.
Getting started
Create the instance on Amazon EC2
Amazon EC2 (Elastic Compute Cloud) is a scalable cloud infrastructure service that allows you run virtual servers, select multiple operating systems and processors options, configure network security and manage storage and memory. You can add or reduce resource capacity according to your business needs.
1. Let's access the AWS account. Access the site https://aws.amazon.com/ec2/ and click on the button Sign In to the Console.
2. Now we will click on the button Sign in using root user email.
3. Next, we will click on the option Root user, fill in the field Email address and click on the button Next.
4. Then, we will fill in the field Password and click on the button Sign in.
5. After sign in, we will type ec2 in the search field and click on the option EC2.
6. Now we will click on the link Instances (running).
7. Next, we will click on the button Launch instances.
8. Then, we will fill in the field Name, select the option Amazon Linux 2023 AMI in the field Amazon Machine Image (AMI), select the option Proceed without a key pair (Not recommended) in the field Key pair name - required and click on the button Launch instance.
9. Ready! The Amazon EC2 instance was created with the Amazon Linux 2023 AMI operating system.
Create the root user access
1. Let's create access for the root user. We will click on the menu Instances.
2. Now we will click on the link of the instance created.
3. Next, we will click on the tab Connect.
4. Then, we will click on the button EC2 Instance Connect.
5. After access the tab EC2 Instance Connect, we will click on the button Connect.
6. Now we will type the command sudo -i
to log in with the user root.
7. Next, we will type the command passwd
to configure the root user password.
8. Then, we will add the remote access settings for the root user in the file /etc/ssh/sshd_config
.
PermitRootLogin yes
PasswordAuthentication yes
9. After add the remote access settings for the root user, we will type the command systemctl restart sshd
to restart the SSH service.
10. Now we will test the remote access with the root user. We will go to the page that contains the instance informations and click on the icon to copy the public IP address.
11. Next, we will type the command ssh root@3.80.139.206
using public IP address to access the remote virtual server.
ssh root@3.80.139.206
The authenticity of host '3.80.139.206 (3.80.139.206)' can't be established.
ED25519 key fingerprint is SHA256:iQxE9Tn+UVDJGCQPe0ImkZ4W+/akI3VEiyHaHipPUXU.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:46: ec2-3-80-139-206.compute-1.amazonaws.com
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '3.80.139.206' (ED25519) to the list of known hosts.
root@3.80.139.206's password:
A newer release of "Amazon Linux" is available.
Version 2023.6.20250123:
Run "/usr/bin/dnf check-release-update" for full release and version update info
, #_
~\_ ####_ Amazon Linux 2023
~~ \_#####\
~~ \###|
~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023
~~ V~' '->
~~~ /
~~._. _/
_/ _/
_/m/'
Last failed login: Sat Jan 25 14:30:25 UTC 2025 from 187.180.189.101 on ssh:notty
There were 82 failed login attempts since the last successful login.
12. Ready! The remote access to the root user was created and tested.
Create the root user access
The free tier usage alert helps you monitor your AWS service usage and cost by sending you email notifications when you exceed 100% of your free tier limit.
1. Let's create the free tier usage alert. We will click on the user menu and click on the menu Billing and Cost Management.
2. Now we will click on the menu Billing Preferences.
3. Next, we will click on the button Edit.
4. Then, we will click on the option Receive AWS Free Tier alerts, fill in the field Email address to receive Free Tier usage alerts - optional and click on the button Update.
5. Ready! The free tier usage alert was created.
Conclusion
Summarizing what was covered in this article:
- We created an Amazon EC2 instance using the Amazon Linux 2023 AMI operating system image.
- We created the root user access to access the remote virtual server.
- We created the free tier usage alert to monitor the usage and cost of AWS services.
You can use this article to create a virtual server, install and run a database or an HTTP server or an application in a certain programming language.
Thank you for reading and I hope you enjoyed the article!
This tutorial was posted on my blog in portuguese.
To stay updated whenever I post new articles, follow me on Twitter and LinkedIn.
Top comments (0)