Your EC2 instance username depends on the operating system and Amazon Machine Image (AMI) you chose when you launched it

Amazon does not assign a single username to every EC2 instance. Instead, the default username is built into the AMI — the template you selected when you created the instance. A Windows Server AMI comes with "Administrator". A Ubuntu AMI comes with "ubuntu". An Amazon Linux 2 AMI comes with "ec2-user". If you chose a different operating system or a custom image, the username will be different again.

The fastest way to find out which username belongs to your instance is to check the AMI details in your AWS console, or to look at the documentation for the specific image you selected. If you no longer remember which AMI you used, AWS stores that information in your instance details.

Key Takeaways

  • The default username is determined by the AMI you selected when launching the instance, not assigned by AWS after the fact.
  • Common defaults are "ec2-user" for Amazon Linux, "ubuntu" for Ubuntu, "admin" for Debian, and "Administrator" for Windows.
  • You can find which AMI you used by opening your instance details in the EC2 console under the "Details" tab.
  • If you created a custom AMI or launched from a third-party image, check that vendor's documentation for the correct username.

Finding the AMI name in your EC2 console

Open the EC2 Dashboard in your AWS console. Under "Instances", find the instance you need the username for and click on it to open the details panel. Look for the field labeled "AMI ID" — this is a string that starts with "ami-" followed by numbers and letters.

Next to the AMI ID, you will see the AMI name — the human-readable label. This name tells you which operating system and version you are running. For example, "amzn2-ami-hvm-2.0.20240101.0-x86_64-gp2" indicates Amazon Linux 2. "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20240101" indicates Ubuntu 20.04.

Once you know the AMI name or operating system, match it to the username table below. If the name does not match any of these, the AMI is custom or from a third party — search the vendor's documentation for the default username.

Default usernames by operating system

Operating System / AMIDefault Username
Amazon Linux 2ec2-user
Amazon Linux (original, older)ec2-user
Ubuntuubuntu
Debianadmin
Red Hat Enterprise Linux (RHEL)ec2-user
CentOScentos
Windows ServerAdministrator
SUSE Linuxec2-user

These usernames are set by the AMI publisher, not by AWS. If you are using a marketplace AMI from a vendor like Canonical (Ubuntu) or Red Hat, the username is part of their standard image. If you created your own AMI from a snapshot, the username is whatever you configured in that snapshot.

What to do if you do not remember which AMI you used

If the AMI name in your instance details is unclear or you cannot find it, you can also check the AMI section of your EC2 console. Click "AMIs" in the left sidebar, then search for the AMI ID from your instance. The AMI details page will show you the operating system and version more clearly.

Another option is to try connecting to the instance and running a command to identify the operating system. On Linux, you can use SSH to connect and then run cat /etc/os-release or lsb_release -a to see the operating system name. On Windows, you would connect via RDP and check System Information. However, this requires that you already have a way to connect — which usually means you need the username first, so this approach works best as a backup.

Connecting to your instance once you know the username

Once you have the username, you will need two more things to connect: the public IP address or DNS name of your instance (also visible in the instance details), and either a key pair file (for Linux) or the password (for Windows).

For Linux instances, you connect via SSH using the key pair you selected when you launched the instance. The command looks like this: ssh -i /path/to/your-key.pem ec2-user@your-instance-ip. Replace "ec2-user" with the correct username for your AMI, and replace "your-instance-ip" with the public IP or DNS name from your instance details.

For Windows instances, you use Remote Desktop Protocol (RDP) to connect. You will need the Administrator username and the password, which AWS generates and encrypts with your key pair. You can retrieve the decrypted password from the instance details panel by clicking "Connect" and then "RDP client" — AWS will show you the password there.

Custom AMIs and third-party images

If you launched your instance from a custom AMI that you or your organization created, the default username depends on how that AMI was built. Check with whoever created the image, or look for documentation in your organization's internal wiki or runbook.

If you launched from a marketplace AMI — an image published by a vendor like Bitnami, Canonical, or a software company — the username is usually documented on the marketplace listing or in the vendor's setup guide. Search the AMI name in the AWS Marketplace or on the vendor's website to find the correct username.

Frequently Asked Questions

Can I change the default username on my instance?

You can create additional user accounts on your instance after you connect, but you cannot change the default username that comes with the AMI. If you need a different username to be the default, you would need to create a new AMI with that username configured, then launch future instances from that custom image.

What if I try to connect with the wrong username?

SSH will reject the connection with a "Permission denied" message. RDP will show an authentication error. If you get either of these, double-check the AMI name in your instance details and try again with the correct username from the table above.

Do I need the username to stop or terminate my instance?

No. You can stop, terminate, reboot, or manage your instance from the EC2 console without ever connecting to it or knowing the username. The username is only needed if you want to log in and run commands inside the instance.

What if my instance is running Windows but I do not know the password?

AWS generates and encrypts the password when you launch a Windows instance. You can retrieve the decrypted password from the EC2 console by selecting your instance, clicking "Connect", and then clicking "RDP client". AWS will display the password there — you will need the key pair file you selected at launch to decrypt it.