• Home
  • How to login to Ec2 without SSH keys

How to login to Ec2 without SSH keys.

Amazon Web Services (AWS) Systems Manager (SSM) allows you to remotely manage your EC2 instances. You can use SSM to access and perform tasks on your instances without the need for SSH or RDP access. Here’s a step-by-step guide on how to use AWS SSM to login to an AWS instance:

  1. Set Up AWS SSM:
  • Make sure you have the necessary IAM permissions to use SSM. You will need permissions for the AmazonSSMManagedInstanceCore and AmazonSSMFullAccess managed policies.
  • Ensure that the AWS Systems Manager Agent (SSM Agent) is installed and running on your EC2 instances. It comes pre-installed on most Amazon Machine Images (AMIs).
  1. Create an SSM Role:
  • If you haven’t already, create an IAM role with permissions for Systems Manager. This role should be attached to your EC2 instances.
  1. Associate the IAM Role with EC2 Instances:
  • Go to the AWS Management Console and select the EC2 instances you want to manage with SSM.
  • Under “Actions,” choose “Instance Settings,” and then “Attach/Replace IAM Role.”
  • Attach the IAM role you created in step 2.
  1. Install the AWS CLI (Command Line Interface) if you haven’t already.
  2. Use the AWS CLI to Start an SSM Session:
  • Open a terminal on your local machine.
  1. Start an SSM Session using AWS CLI:
  • Use the following command to start an SSM session to your instance: aws ssm start-session --target <instance-id> Replace <instance-id> with the actual ID of the EC2 instance you want to access.
  1. Access the Instance:
  • Once you run the command from step 6, it will start an interactive session with your EC2 instance.
  1. Perform Desired Tasks:
  • You now have a shell session on the EC2 instance and can perform tasks just as you would if you were logged in through SSH (Linux) or RDP (Windows).
  1. Exit the SSM Session:
  • To exit the session, simply type exit or Ctrl+D.

AWS Systems Manager SSM provides a secure way to access and manage your EC2 instances without exposing SSH or RDP ports to the internet. It also offers features like session logging and access control for added security and compliance.

Remember to follow AWS security best practices and ensure that your IAM roles and permissions are set up correctly to maintain a secure environment.

written by
kashif mehmood

Leave Comment