Creating an EC2 Instance
Creating an Amazon EC2 (Elastic Compute Cloud) instance is a straightforward process that allows you to run virtual servers in the cloud. Here’s a step-by-step guide to launching an EC2 instance.
- Step 1: Log In to the AWS Management Console
- Step 2: Navigate to EC2
- Step 3: Launch an Instance
- Step 4: Choose an Amazon Machine Image (AMI)
- Step 5: Choose an Instance Type
- Step 6: Configure Instance Details
- Step 7: Add Storage
- Step 8: Add Tags
- Step 9: Configure Security Group
- Step 10: Review Instance Launch
- Step 11: Select or Create Key Pair
- Step 12: Access Your EC2 Instance
- Conclusion
Step 1: Log In to the AWS Management Console
- Access the AWS Management Console:
- Go to the AWS Management Console.
- Sign in with your AWS account credentials.
Step 2: Navigate to EC2
- Find EC2:
- In the services menu, search for EC2 and click on it to access the EC2 dashboard.
Step 3: Launch an Instance
- Click on Launch Instance:
- In the EC2 dashboard, click on the Launch Instance button.
Step 4: Choose an Amazon Machine Image (AMI)
- Select an AMI:
- Choose a pre-configured template that contains the operating system and software you need.
- Common options include:
- Amazon Linux 2
- Ubuntu Server
- Windows Server
- Click the Select button next to your preferred AMI.
Step 5: Choose an Instance Type
- Select Instance Type:
- Choose the instance type that suits your needs based on CPU, memory, storage, and networking capacity.
- For example:
- t2.micro (eligible for the free tier) is suitable for lightweight applications.
- Click the Next: Configure Instance Details button.
Step 6: Configure Instance Details
- Set Instance Configurations:
- Specify the number of instances, network settings, IAM role (if applicable), and other options.
- Important settings to consider:
- Network: Select the VPC (Virtual Private Cloud).
- Subnet: Choose an appropriate subnet within the VPC.
- Click the Next: Add Storage button.
Step 7: Add Storage
- Configure Storage:
- Adjust the default storage settings if needed (e.g., volume type, size).
- You can also add additional EBS volumes if required.
- Click the Next: Add Tags button.
Step 8: Add Tags
- Tag Your Instance:
- Tags are key-value pairs that help organize and manage your instances.
- For example, you can add a tag with Key as “Name” and Value as “MyFirstEC2Instance”.
- Click the Next: Configure Security Group button.
Step 9: Configure Security Group
- Set Up Security Group:
- A security group acts as a virtual firewall for your instance.
- You can create a new security group or select an existing one.
- Define inbound rules to control traffic (e.g., allow SSH on port 22 for Linux instances or RDP on port 3389 for Windows instances).
- Click the Review and Launch button.
Step 10: Review Instance Launch
- Review Your Settings:
- Check all the settings you’ve configured. Ensure everything is correct.
- Click the Launch button.
Step 11: Select or Create Key Pair
- Choose a Key Pair:
- You need a key pair to securely connect to your instance.
- You can select an existing key pair or create a new one:
- Create a new key pair: Provide a name and download the
.pem
file (keep it secure).
- Create a new key pair: Provide a name and download the
- If you choose an existing key pair, ensure you have access to the private key.
- Click the Launch Instances button.
Step 12: Access Your EC2 Instance
- View Your Instances:
- Go to the Instances section in the EC2 dashboard to see your newly launched instance.
- Wait for the instance state to change from “pending” to “running.”
- Connect to Your Instance:
- For Linux Instances:
- Open a terminal and use the following SSH command (replace
/path/to/your-key.pem
andyour-public-dns
accordingly):
ssh -i /path/to/your-key.pem ec2-user@your-public-dns
- Open a terminal and use the following SSH command (replace
- For Windows Instances:
- Use Remote Desktop Protocol (RDP) to connect:
- Download the RDP file and use the username and password obtained through the AWS console.
Conclusion
You have successfully created and launched an EC2 instance on AWS! From here, you can deploy applications, manage configurations, and scale your infrastructure based on your needs. Don’t forget to monitor your instance and set up backups as necessary to ensure data safety and continuity.