What is Amazon EC2 instance?
Amazon Elastic Compute Cloud (Amazon EC2) is a web service provided by Amazon Web Services (AWS) that offers scalable virtual servers, known as instances, in the cloud. It allows users to run applications on a virtual machine with varying configurations of CPU, memory, storage, and networking capacity, based on their needs.
Key features of Amazon EC2 include:
- Scalability: You can easily scale up or down the number of instances and their capacity according to your workload.
- Flexibility: EC2 supports various operating systems and allows users to customize the environment to run their applications.
- Pay-as-You-Go Pricing: You only pay for the compute capacity that you use, making it cost-effective for both short-term and long-term projects.
- Security: EC2 integrates with other AWS services to provide a secure environment, including firewall settings, encryption, and identity management.
- Global Reach: EC2 instances can be launched in multiple AWS regions across the world, enabling low-latency connections and data redundancy.
Overall, Amazon EC2 provides a flexible, reliable, and scalable environment to deploy applications and services in the cloud.
What is amazon free tier eligible?
Amazon Free Tier is a program offered by Amazon Web Services (AWS) that allows new AWS customers to use certain services for free, up to specified limits, for a limited time (usually 12 months) or indefinitely in some cases. It's designed to help users get started with AWS without incurring costs as they explore and experiment with the platform's various services.
You can read more about the Free Tier here.
Steps To launch the EC2 instance:
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
Note: Be sure to select the AWS Region that you want to launch the instance in. It's probably best to select the closest location to you, - After you, login into the Amazon management console, open EC2 Dashboard, click on the Launch Instance drop-down list, and click on Launch Instance:
3. Once the Launch an instance window opens, provide the name of your EC2 Instance:
4. Choose the AMI. Here you see multiple AMI options for selection. AMI stands for Amazon Machine Image, which is basically the software and the operating system that you want to launch on the server, in my case I chose Ubuntu 22.04.
5. Choose an Instance Type. Here you can select the type of machine, number of vCPUs, and memory that you want to have. Select t2.micro which is free-tier eligible.
6. Select an already existing key pair or create a new key pair. Here, I will create a new key pair. Click on Create new key pair as shown below:
A new window will open, enter the Key pair name and click on Create key pair.
This key pair will allow you to access using SSH into the machine you just created. Create the key pair and download it, make sure to keep it safe as you will not be able to download it again.
7. Now under Network Settings, Choose the default VPC with Auto-assign public IP in enable mode. Create a new Security Group, provide a name for your security group, and allow ssh traffic, HTTPS, and HTTP from anywhere (later on we can modify the rules)
8. Select the amount of storage you want your instance to have, for the free tier, you can choose up to 30 GB of EBS. I’ll leave this to default and Click on “Launch Instance”
9. On the screen you can see a success message after the successful creation of the EC2 instance, click on Connect to instance button:
10. Now connect to instance wizard will open, go to SSH client tab and copy the provided chmod and SSH command:
11. Manage and Monitor Your Instance
From the EC2 Dashboard, you can monitor the instance’s performance, manage security settings, and terminate the instance when no longer needed.
Conclusion
Launching an EC2 instance is a straightforward process that provides you with scalable computing power in minutes. Whether you're setting up a simple web server or a complex application environment, EC2's flexibility and integration with other AWS services make it a powerful tool in any developer’s toolkit. Experiment with different instance types and configurations to find the best fit for your needs, and remember to terminate instances when they’re no longer needed to avoid unnecessary costs.