In previous articles, I have mentioned how to Resize or Upgrade AWS EC2 Instance and What is EC2 (Elastic Compute Cloud) in AWS but now in this article, I have provided step by step procedure to reboot or restart AWS EC2 Instance using AWS Console or using CLI.

There can be situtaion in your EC2 Instance, when you would like to reboot or restart it.

For example, I had some issue on AWS EC2 Instance, I wasn't able to connect to it using RDP until I reboot the system, so in the cases like this we would have to restart or reboot AWS EC2 Instance.

Rebooting an instance is like rebooting a PC, so let's take a look on few way of restarting or rebooting AWS EC2 Instance.

Reboot EC2 Instance using AWS Console

For rebooting AWS EC2 instance using the console, you need to follow below given steps:

  1. Login into your AWS EC2 Console.
  2. Navigate to "Instances" (From left-pane) and Select instance which you want to reboot or restart
  3. Right-click on it and then select "Reboot"
    reboot-restart-aws-ec2-instance
  4. A pop-up will appear, Click 'Yes, Reboot' and confirm.

That's it, now your EC2 will restart in few minutes (1-2 minutes most of the time), during this time-frame, you may not able to access website uploaded on that instance, but if you are using caching using Cloudflare CDN or using Amazon CloudFront content delivery network (CDN), then it show cached pages of website to user.

Restart or reboot AWS Instance using CLI

You can also use Command line Interface tool to reboot or restart AWS instance.

For example, below command will reboot instance, but will not return any success message

aws ec2 reboot-instances --instance-ids i-1234567890abcdef5

Reboot AWS using Powershell

First, we will need AWS key and credentials for this, here are the steps to follow

  1. Go to your account, select Security Credentials and create an AWS access key and secret key.
  2. Open Power-Shell for AWS, which will ask for your AWS Access Key and Secret Key.
  3. If Power-Shell doesn't prompt for keys go to "C:\Users\Administrator\AppData\Local\AWSToolkit" and delete the Registered Account Jsonfile and open Power-Shell again.
  4. Now get your instance id by using this URL from EC2 instance
    http://179.254.169.254/latest/meta-data/instance-id
    
    // here 179.254.169.254 is my private ip for instance?
  5. Now from powershell give below command
    Restart-EC2Instance -InstanceId i-12345678?

That's it, it will reboot your AWS Instance.

You may also like to read:

How to check the total number of object stored in S3 bucket in AWS?

How can I download complete AWS S3 Bucket Locally?

Create EC2 instance with step by step guide (Windows Server instance)

Error : This configuration section cannot be used at this path. This happens when the section is locked at a parent level?