This page covers the basic setup steps for creating an EC2 Linux instance on Amazon Web Services (AWS).
1. Choose an AMI (Amazon Machine Image)
What is an AMI? An AMI is a template that contains the software configuration (operating system, application server, applications, etc.) required to launch an EC2 instance. This step determines which OS you will use.
Key Considerations:
- Operating System: Choose from various OS options such as Ubuntu, Amazon Linux, Red Hat Enterprise Linux (RHEL), CentOS, SUSE Linux.
- Version: It's recommended to select a stable, recent version of the chosen OS.
- AWS Marketplace: You can also use AMIs with pre-installed software or configurations from the AWS Marketplace.
How to Choose:
When launching an instance from the AWS EC2 console, in the 'Choose an AMI' step, you can search for and select your desired OS. For example, you might choose Ubuntu Server 22.04 LTS (HVM), SSD Volume Type.
2. Decide on an Instance Type
What is an Instance Type? An instance type determines the CPU, memory, storage, and network capacity of your instance. You should select an appropriate type based on your intended use.
Key Considerations:
- t-series (General Purpose): e.g., t2.micro, t3.micro. These are eligible for the Free Tier and suitable for development/testing or web servers with low traffic. They feature burstable performance.
- m-series (General Purpose): e.g., m5.large, m6g.medium. Offers a balanced mix of CPU and memory resources.
- c-series (Compute Optimized): e.g., c5.large, c6g.medium. Used when high compute performance is required.
- r-series (Memory Optimized): e.g., r5.large, r6g.medium. Suitable for memory-intensive workloads like large databases.
How to Choose:
In the 'Choose an Instance Type' step, select the instance type that matches your performance requirements. For Free Tier users, t2.micro or t3.micro should be considered first.
3. Generate and Use a Key Pair
What is a Key Pair? A key pair is a digital credential used for securely connecting to your EC2 instance. The public key is stored on AWS, and the private key is downloaded to your machine. You cannot access your instance without this private key (.pem file).
How to Generate:
- Select 'Create a new key pair' and enter a key pair name.
- Choose the key pair type (RSA or ED25519) and file format (.pem or .ppk). Use .pem for Linux/macOS terminals and .ppk for Windows SSH clients like PuTTY.
- Once created, the private key file will automatically download. You must keep this file secure.
How to Use:
After the instance is launched, you will use this private key file for authentication when connecting via an SSH client (terminal or PuTTY).
chmod 400 your-key-pair.pem ssh -i "your-key-pair.pem" ubuntu@YOUR_INSTANCE_PUBLIC_IP
(`ubuntu` might be a different username depending on the AMI; e.g., Amazon Linux uses `ec2-user`)