Table of contents
Introduction
In today's post, we'll dive into the foundational AWS service, EC2 (Elastic Compute Cloud). EC2 allows you to launch virtual servers—known as instances—on the cloud. We'll walk through the steps to set up your first EC2 instance and access it.
Prerequisites
Before we begin, make sure you have:
An AWS account (if not, refer to Day 1 Click here for instructions on creating one).
Basic familiarity with the AWS Management Console.
Steps to Set Up an EC2 Instance
Log in to AWS Management Console
- Go to AWS Management Console and log in using your credentials.
Navigate to EC2 Dashboard
- In the AWS Management Console, find and select the EC2 service from the list of available services.
Launch Instance
Click on the "Launch Instance" button to start the instance creation process.
Choose an Amazon Machine Image (AMI)
Select an AMI that suits your needs. For beginners, you can choose a free-tier eligible AMI like Amazon Linux or Ubuntu.
Choose an Instance Type
Select the instance type based on your application requirements
(e.g., t2.micro for free-tier eligible instances).
Configure Instance Details
Configure instance details such as network settings, subnet, IAM role
(if needed), etc. Leave the default settings for now if you're unsure.
Add Storage
- Specify the storage requirements for your instance. The default configuration includes a root EBS (Elastic Block Store) volume. Adjust size and type as necessary.
Add Tags (Optional)
- Optionally, add tags to your instance for easier identification and organization.
Configure Security Group
- Create a new security group or select an existing one. Configure inbound and outbound rules to control traffic to your instance.
Review and Launch
- Review your instance configuration. Make sure everything looks good before launching the instance.
Launch Instance
- Click on the "Launch" button. A prompt will ask you to select or create a key pair. Create a new key pair and download the private key file (.pem). This key pair is crucial for accessing your instance securely.
Access Your Instance
Once launched, you can see your instance in the EC2 dashboard. Note down the Public DNS or IP address of your instance.
Use SSH (Secure Shell) to connect to your instance from your local machine:
ssh -i /path/to/your-key.pem ec2-user@your-instance-public-dns-or-ip
Replace
/path/to/your-key.pem
with the path to your downloaded private key file andec2-user
with the appropriate user for your AMI.
Conclusion
Congratulations you have successfully launched your first EC2 instance on AWS. In this post, we covered the essential steps from AMI selection to instance launch and access. Stay tuned for more AWS tutorials and tips in our series.