AWS EC2 (Elastic Compute Cloud) is a popular cloud computing service provided by Amazon Web Services (AWS). It allows users to quickly provision and configure virtual servers, known as instances, in the cloud. EC2 offers elastic scalability, a wide range of instance types, pay-as-you-go pricing, integration with the AWS ecosystem, and advanced security features. With EC2, businesses can easily scale resources, choose the right instance type, pay for what they use, and benefit from seamless integration with other AWS services. EC2 simplifies infrastructure management and enabling faster application deployment
This article will show the steps needed to create an EC2 instance that you can use to host and run an application.
First of all you will need to create a root user from the AWS site https://aws.amazon.com. You will need a card in order to create the account, however you won't be charged unless you use a service that has a cost. For the purpose of this article, we will use a free instance image. At the moment of writing this post, this is what a free tier EC2 image offers:
Free tier: In your first year includes 750 hours of t2.micro (or t3.micro in the Regions in which t2.micro is unavailable) instance usage on free tier AMIs per month, 30 GiB of EBS storage, 2 million IOs, 1 GB of snapshots, and 100 GB of bandwidth to the internet.
Once you have already created your account and login. You will get into the console page. From here, follow below steps:
Then you will be directed to the instances dashboard. Once the value on Instance state shows as Running, you will be able to connect to your new EC2 instance.
From EC2 instances page, click the id under "Instance ID" column. Then click on the "Connect" button. You will see a page with the instructions to stablish a ssh connection to your EC2 machine. You can even copy an example ssh command, so you can run this one as such, you just need to make sure to be located on the directory where you have the .pem file.
[] $ ssh -i "linux1.pem" ec2-user@{your-vm-public-DNS}
If everything goes fine, you should see an Amazon Linux welcome prompto, and you will see that you are login as ec2-user. From ec2-user, you will be able to work as root by running
[] $ sudo su -