How to launch an EC2 instance

Topic: Cloud aws core

Summary

Launch an Amazon EC2 instance from the console or CLI: choose AMI, instance type, key pair, and network. Use this when you need a new Linux or Windows server in AWS and want to get it running with the right size and access (SSH or RDP key).

Intent: How-to

Quick answer

  • In EC2 console choose Launch Instance; pick an AMI (e.g. Amazon Linux 2023), instance type (t3.micro for trial), key pair for SSH/RDP, and VPC/subnet. Configure storage and security group (e.g. allow SSH 22).
  • CLI: aws ec2 run-instances --image-id ami-xxx --instance-type t3.micro --key-name MyKey --security-group-ids sg-xxx --subnet-id subnet-xxx. Tag the instance for billing and ops.
  • After launch, get public IP or DNS from the console or aws ec2 describe-instances; use the key pair to SSH (Linux) or RDP (Windows). Ensure security group allows your IP on port 22 or 3389.

Steps

  1. Choose AMI and instance type

    Select an AMI (Amazon Linux, Ubuntu, etc.) and instance type (t3.micro for low cost, larger for production). Note the region; AMI IDs differ by region.

  2. Configure network and key pair

    Select VPC and subnet (default or custom). Create or select a key pair for SSH or RDP; store the private key securely. Assign a security group that allows inbound SSH (22) or RDP (3389) from your IP or a bastion.

  3. Storage and launch

    Add or resize root EBS volume if needed; add additional volumes for data. Review and launch; tag with Name and purpose (e.g. Environment, Project) for billing and ops.

  4. Connect

    Get public IP or DNS from console or describe-instances. SSH with the key: ssh -i key.pem ec2-user@PUBLIC_IP. If connection refused, check security group and that the instance is running.

Summary

Launch EC2 by choosing AMI, instance type, key pair, and network; set storage and security group; tag and connect with the key. Use this to create a new instance with the right access.

Prerequisites

None.

Steps

Step 1: Choose AMI and instance type

Pick AMI and instance type in the chosen region. Note AMI IDs are region-specific.

Step 2: Configure network and key pair

Select VPC/subnet; attach a key pair and a security group that allows SSH or RDP from your IP or bastion.

Step 3: Storage and launch

Set root and any extra EBS volumes; add tags; launch.

Step 4: Connect

Get public IP; connect with ssh -i key.pem ec2-user@IP. Fix security group or network if connection fails.

Verification

Instance is running; you can SSH or RDP with the key; tags are set.

Troubleshooting

Connection refused — Security group may not allow your IP on 22/3389; check NACL and route table. No public IP — Use a subnet with auto-assign or attach an Elastic IP; or connect via bastion.

Next steps

Continue to